diff --git a/AtmosJS/build.xml b/AtmosJS/build.xml
deleted file mode 100644
index 9c4d3e4..0000000
--- a/AtmosJS/build.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AtmosJS/lib-min/crypto-sha1-hmac-pbkdf2-ofb-aes.js b/AtmosJS/lib-min/crypto-sha1-hmac-pbkdf2-ofb-aes.js
deleted file mode 100644
index ac882fd..0000000
--- a/AtmosJS/lib-min/crypto-sha1-hmac-pbkdf2-ofb-aes.js
+++ /dev/null
@@ -1,17 +0,0 @@
-if(typeof Crypto=="undefined"||!Crypto.util)(function(){var l=window.Crypto={},p=l.util={rotl:function(e,g){return e<>>32-g},rotr:function(e,g){return e<<32-g|e>>>g},endian:function(e){if(e.constructor==Number)return p.rotl(e,8)&16711935|p.rotl(e,24)&4278255360;for(var g=0;g0;e--)g.push(Math.floor(Math.random()*256));return g},bytesToWords:function(e){for(var g=[],f=0,h=0;f>>5]|=e[f]<<24-
-h%32;return g},wordsToBytes:function(e){for(var g=[],f=0;f>>5]>>>24-f%32&255);return g},bytesToHex:function(e){for(var g=[],f=0;f>>4).toString(16));g.push((e[f]&15).toString(16))}return g.join("")},hexToBytes:function(e){for(var g=[],f=0;f>>6*(3-j)&63)):g.push("=");return g.join("")},base64ToBytes:function(e){if(typeof atob=="function")return q.stringToBytes(atob(e));e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var g=[],f=0,h=0;f>>
-6-h*2);return g}};l.mode={};l=l.charenc={};l.UTF8={stringToBytes:function(e){return q.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(q.bytesToString(e)))}};var q=l.Binary={stringToBytes:function(e){for(var g=[],f=0;f>5]|=128<<24-k%32;j[(k+64>>>9<<4)+15]=k;for(k=0;k>>31}i=(r<<5|r>>>27)+x+(h[d]>>>0)+(d<20?(m&s|~m&n)+1518500249:d<40?(m^s^n)+1859775393:d<60?(m&s|m&n|s&n)-1894007588:(m^s^n)-899497514);x=n;n=s;s=m<<30|m>>>2;m=r;r=i}r+=c;m+=t;s+=v;n+=o;x+=u}return[r,m,s,n,x]};f._blocksize=16;f._digestsize=20})();
-(function(){var l=Crypto,p=l.util,q=l.charenc,e=q.UTF8,g=q.Binary;l.HMAC=function(f,h,j,k){if(h.constructor==String)h=e.stringToBytes(h);if(j.constructor==String)j=e.stringToBytes(j);if(j.length>f._blocksize*4)j=f(j,{asBytes:true});var r=j.slice(0);j=j.slice(0);for(var m=0;m>>=1}return b}for(var p=Crypto,q=p.util,e=p.charenc.UTF8,g=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,
-208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,
-206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],f=[],h=0;h<256;h++)f[g[h]]=h;var j=[],k=[],r=[],m=[],s=[],n=[];for(h=0;h<256;h++){j[h]=l(h,2);k[h]=l(h,3);r[h]=l(h,9);m[h]=l(h,11);s[h]=l(h,13);n[h]=l(h,14)}var x=[0,1,2,4,8,16,32,64,128,27,54],c=[[],[],[],[]],t,v,o,u=p.AES={encrypt:function(d,i,b){b=b||{};d=e.stringToBytes(d);var a=b.iv||q.randomBytes(u._blocksize*4);i=i.constructor==String?p.PBKDF2(i,a,32,{asBytes:true}):i;var w=b.mode||p.mode.OFB;u._init(i);w.encrypt(u,d,a);
-return q.bytesToBase64(b.iv?d:a.concat(d))},decrypt:function(d,i,b){b=b||{};d=q.base64ToBytes(d);var a=b.iv||d.splice(0,u._blocksize*4);i=i.constructor==String?p.PBKDF2(i,a,32,{asBytes:true}):i;b=b.mode||p.mode.OFB;u._init(i);b.decrypt(u,d,a);return e.bytesToString(d)},_blocksize:4,_encryptblock:function(d,i){for(var b=0;b6&&i%t==4){d[0]=g[d[0]];d[1]=g[d[1]];d[2]=g[d[2]];d[3]=g[d[3]]}o[i]=[o[i-t][0]^d[0],o[i-t][1]^d[1],o[i-t][2]^d[2],o[i-t][3]^d[3]]}}}})();
diff --git a/AtmosJS/nodeunit/nodeunit.css b/AtmosJS/nodeunit/nodeunit.css
deleted file mode 100644
index 274434a..0000000
--- a/AtmosJS/nodeunit/nodeunit.css
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
- * Styles taken from qunit.css
- */
-
-h1#nodeunit-header, h1.nodeunit-header {
- padding: 15px;
- font-size: large;
- background-color: #06b;
- color: white;
- font-family: 'trebuchet ms', verdana, arial;
- margin: 0;
-}
-
-h1#nodeunit-header a {
- color: white;
-}
-
-h2#nodeunit-banner {
- height: 2em;
- border-bottom: 1px solid white;
- background-color: #eee;
- margin: 0;
- font-family: 'trebuchet ms', verdana, arial;
-}
-h2#nodeunit-banner.pass {
- background-color: green;
-}
-h2#nodeunit-banner.fail {
- background-color: red;
-}
-
-h2#nodeunit-userAgent, h2.nodeunit-userAgent {
- padding: 10px;
- background-color: #eee;
- color: black;
- margin: 0;
- font-size: small;
- font-weight: normal;
- font-family: 'trebuchet ms', verdana, arial;
- font-size: 10pt;
-}
-
-div#nodeunit-testrunner-toolbar {
- background: #eee;
- border-top: 1px solid black;
- padding: 10px;
- font-family: 'trebuchet ms', verdana, arial;
- margin: 0;
- font-size: 10pt;
-}
-
-ol#nodeunit-tests {
- font-family: 'trebuchet ms', verdana, arial;
- font-size: 10pt;
-}
-ol#nodeunit-tests li strong {
- cursor:pointer;
-}
-ol#nodeunit-tests .pass {
- color: green;
-}
-ol#nodeunit-tests .fail {
- color: red;
-}
-
-p#nodeunit-testresult {
- margin-left: 1em;
- font-size: 10pt;
- font-family: 'trebuchet ms', verdana, arial;
-}
diff --git a/AtmosJS/nodeunit/nodeunit.js b/AtmosJS/nodeunit/nodeunit.js
deleted file mode 100644
index a6f9c88..0000000
--- a/AtmosJS/nodeunit/nodeunit.js
+++ /dev/null
@@ -1,1981 +0,0 @@
-/*!
- * Nodeunit
- * https://github.com/caolan/nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * json2.js
- * http://www.JSON.org/json2.js
- * Public Domain.
- * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
- */
-nodeunit = (function(){
-/*
- http://www.JSON.org/json2.js
- 2010-11-17
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, strict: false, regexp: false */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (!this.JSON) {
- this.JSON = {};
-}
-
-(function () {
- "use strict";
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf()) ?
- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ?
- '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
-.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
-.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
-.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
-var assert = this.assert = {};
-var types = {};
-var core = {};
-var nodeunit = {};
-var reporter = {};
-/*global setTimeout: false, console: false */
-(function () {
-
- var async = {};
-
- // global on the server, window in the browser
- var root = this,
- previous_async = root.async;
-
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = async;
- }
- else {
- root.async = async;
- }
-
- async.noConflict = function () {
- root.async = previous_async;
- return async;
- };
-
- //// cross-browser compatiblity functions ////
-
- var _forEach = function (arr, iterator) {
- if (arr.forEach) {
- return arr.forEach(iterator);
- }
- for (var i = 0; i < arr.length; i += 1) {
- iterator(arr[i], i, arr);
- }
- };
-
- var _map = function (arr, iterator) {
- if (arr.map) {
- return arr.map(iterator);
- }
- var results = [];
- _forEach(arr, function (x, i, a) {
- results.push(iterator(x, i, a));
- });
- return results;
- };
-
- var _reduce = function (arr, iterator, memo) {
- if (arr.reduce) {
- return arr.reduce(iterator, memo);
- }
- _forEach(arr, function (x, i, a) {
- memo = iterator(memo, x, i, a);
- });
- return memo;
- };
-
- var _keys = function (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
- var keys = [];
- for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- keys.push(k);
- }
- }
- return keys;
- };
-
- var _indexOf = function (arr, item) {
- if (arr.indexOf) {
- return arr.indexOf(item);
- }
- for (var i = 0; i < arr.length; i += 1) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- };
-
- //// exported async module functions ////
-
- //// nextTick implementation with browser-compatible fallback ////
- if (typeof process === 'undefined' || !(process.nextTick)) {
- async.nextTick = function (fn) {
- setTimeout(fn, 0);
- };
- }
- else {
- async.nextTick = process.nextTick;
- }
-
- async.forEach = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- _forEach(arr, function (x) {
- iterator(x, function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- }
- });
- });
- };
-
- async.forEachSeries = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- var iterate = function () {
- iterator(arr[completed], function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- else {
- iterate();
- }
- }
- });
- };
- iterate();
- };
-
-
- var doParallel = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEach].concat(args));
- };
- };
- var doSeries = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEachSeries].concat(args));
- };
- };
-
-
- var _asyncMap = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (err, v) {
- results[x.index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- };
- async.map = doParallel(_asyncMap);
- async.mapSeries = doSeries(_asyncMap);
-
-
- // reduce only has a series version, as doing reduce in parallel won't
- // work in many situations.
- async.reduce = function (arr, memo, iterator, callback) {
- async.forEachSeries(arr, function (x, callback) {
- iterator(memo, x, function (err, v) {
- memo = v;
- callback(err);
- });
- }, function (err) {
- callback(err, memo);
- });
- };
- // inject alias
- async.inject = async.reduce;
- // foldl alias
- async.foldl = async.reduce;
-
- async.reduceRight = function (arr, memo, iterator, callback) {
- var reversed = _map(arr, function (x) {
- return x;
- }).reverse();
- async.reduce(reversed, memo, iterator, callback);
- };
- // foldr alias
- async.foldr = async.reduceRight;
-
- var _filter = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.filter = doParallel(_filter);
- async.filterSeries = doSeries(_filter);
- // select alias
- async.select = async.filter;
- async.selectSeries = async.filterSeries;
-
- var _reject = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (!v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.reject = doParallel(_reject);
- async.rejectSeries = doSeries(_reject);
-
- var _detect = function (eachfn, arr, iterator, main_callback) {
- eachfn(arr, function (x, callback) {
- iterator(x, function (result) {
- if (result) {
- main_callback(x);
- }
- else {
- callback();
- }
- });
- }, function (err) {
- main_callback();
- });
- };
- async.detect = doParallel(_detect);
- async.detectSeries = doSeries(_detect);
-
- async.some = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (v) {
- main_callback(true);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(false);
- });
- };
- // any alias
- async.any = async.some;
-
- async.every = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (!v) {
- main_callback(false);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(true);
- });
- };
- // all alias
- async.all = async.every;
-
- async.sortBy = function (arr, iterator, callback) {
- async.map(arr, function (x, callback) {
- iterator(x, function (err, criteria) {
- if (err) {
- callback(err);
- }
- else {
- callback(null, {value: x, criteria: criteria});
- }
- });
- }, function (err, results) {
- if (err) {
- return callback(err);
- }
- else {
- var fn = function (left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- };
- callback(null, _map(results.sort(fn), function (x) {
- return x.value;
- }));
- }
- });
- };
-
- async.auto = function (tasks, callback) {
- callback = callback || function () {};
- var keys = _keys(tasks);
- if (!keys.length) {
- return callback(null);
- }
-
- var completed = [];
-
- var listeners = [];
- var addListener = function (fn) {
- listeners.unshift(fn);
- };
- var removeListener = function (fn) {
- for (var i = 0; i < listeners.length; i += 1) {
- if (listeners[i] === fn) {
- listeners.splice(i, 1);
- return;
- }
- }
- };
- var taskComplete = function () {
- _forEach(listeners, function (fn) {
- fn();
- });
- };
-
- addListener(function () {
- if (completed.length === keys.length) {
- callback(null);
- }
- });
-
- _forEach(keys, function (k) {
- var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
- var taskCallback = function (err) {
- if (err) {
- callback(err);
- // stop subsequent errors hitting callback multiple times
- callback = function () {};
- }
- else {
- completed.push(k);
- taskComplete();
- }
- };
- var requires = task.slice(0, Math.abs(task.length - 1)) || [];
- var ready = function () {
- return _reduce(requires, function (a, x) {
- return (a && _indexOf(completed, x) !== -1);
- }, true);
- };
- if (ready()) {
- task[task.length - 1](taskCallback);
- }
- else {
- var listener = function () {
- if (ready()) {
- removeListener(listener);
- task[task.length - 1](taskCallback);
- }
- };
- addListener(listener);
- }
- });
- };
-
- async.waterfall = function (tasks, callback) {
- if (!tasks.length) {
- return callback();
- }
- callback = callback || function () {};
- var wrapIterator = function (iterator) {
- return function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- var args = Array.prototype.slice.call(arguments, 1);
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- }
- else {
- args.push(callback);
- }
- async.nextTick(function () {
- iterator.apply(null, args);
- });
- }
- };
- };
- wrapIterator(async.iterator(tasks))();
- };
-
- async.parallel = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.map(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEach(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.series = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.mapSeries(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEachSeries(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.iterator = function (tasks) {
- var makeCallback = function (index) {
- var fn = function () {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- };
- fn.next = function () {
- return (index < tasks.length - 1) ? makeCallback(index + 1): null;
- };
- return fn;
- };
- return makeCallback(0);
- };
-
- async.apply = function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function () {
- return fn.apply(
- null, args.concat(Array.prototype.slice.call(arguments))
- );
- };
- };
-
- var _concat = function (eachfn, arr, fn, callback) {
- var r = [];
- eachfn(arr, function (x, cb) {
- fn(x, function (err, y) {
- r = r.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, r);
- });
- };
- async.concat = doParallel(_concat);
- async.concatSeries = doSeries(_concat);
-
- async.whilst = function (test, iterator, callback) {
- if (test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.whilst(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.until = function (test, iterator, callback) {
- if (!test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.until(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.queue = function (worker, concurrency) {
- var workers = 0;
- var tasks = [];
- var q = {
- concurrency: concurrency,
- push: function (data, callback) {
- tasks.push({data: data, callback: callback});
- async.nextTick(q.process);
- },
- process: function () {
- if (workers < q.concurrency && tasks.length) {
- var task = tasks.splice(0, 1)[0];
- workers += 1;
- worker(task.data, function () {
- workers -= 1;
- if (task.callback) {
- task.callback.apply(task, arguments);
- }
- q.process();
- });
- }
- },
- length: function () {
- return tasks.length;
- }
- };
- return q;
- };
-
- var _console_fn = function (name) {
- return function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- fn.apply(null, args.concat([function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (typeof console !== 'undefined') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- }
- else if (console[name]) {
- _forEach(args, function (x) {
- console[name](x);
- });
- }
- }
- }]));
- };
- };
- async.log = _console_fn('log');
- async.dir = _console_fn('dir');
- /*async.info = _console_fn('info');
- async.warn = _console_fn('warn');
- async.error = _console_fn('error');*/
-
- async.memoize = function (fn, hasher) {
- var memo = {};
- hasher = hasher || function (x) {
- return x;
- };
- return function () {
- var args = Array.prototype.slice.call(arguments);
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (key in memo) {
- callback.apply(null, memo[key]);
- }
- else {
- fn.apply(null, args.concat([function () {
- memo[key] = arguments;
- callback.apply(null, arguments);
- }]));
- }
- };
- };
-
-}());
-(function(exports){
-/**
- * This file is based on the node.js assert module, but with some small
- * changes for browser-compatibility
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- */
-
-
-/**
- * Added for browser compatibility
- */
-
-var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
-};
-
-
-
-// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
-//
-// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
-//
-// Originally from narwhal.js (http://narwhaljs.org)
-// Copyright (c) 2009 Thomas Robinson <280north.com>
-//
-// 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, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-var pSlice = Array.prototype.slice;
-
-// 1. The assert module provides functions that throw
-// AssertionError's when particular conditions are not met. The
-// assert module must conform to the following interface.
-
-var assert = exports;
-
-// 2. The AssertionError is defined in assert.
-// new assert.AssertionError({message: message, actual: actual, expected: expected})
-
-assert.AssertionError = function AssertionError (options) {
- this.name = "AssertionError";
- this.message = options.message;
- this.actual = options.actual;
- this.expected = options.expected;
- this.operator = options.operator;
- var stackStartFunction = options.stackStartFunction || fail;
-
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, stackStartFunction);
- }
-};
-// code from util.inherits in node
-assert.AssertionError.super_ = Error;
-
-
-// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call
-// TODO: test what effect this may have
-var ctor = function () { this.constructor = assert.AssertionError; };
-ctor.prototype = Error.prototype;
-assert.AssertionError.prototype = new ctor();
-
-
-assert.AssertionError.prototype.toString = function() {
- if (this.message) {
- return [this.name+":", this.message].join(' ');
- } else {
- return [ this.name+":"
- , JSON.stringify(this.expected )
- , this.operator
- , JSON.stringify(this.actual)
- ].join(" ");
- }
-};
-
-// assert.AssertionError instanceof Error
-
-assert.AssertionError.__proto__ = Error.prototype;
-
-// At present only the three keys mentioned above are used and
-// understood by the spec. Implementations or sub modules can pass
-// other keys to the AssertionError's constructor - they will be
-// ignored.
-
-// 3. All of the following functions must throw an AssertionError
-// when a corresponding condition is not met, with a message that
-// may be undefined if not provided. All assertion methods provide
-// both the actual and expected values to the assertion error for
-// display purposes.
-
-function fail(actual, expected, message, operator, stackStartFunction) {
- throw new assert.AssertionError({
- message: message,
- actual: actual,
- expected: expected,
- operator: operator,
- stackStartFunction: stackStartFunction
- });
-}
-
-// EXTENSION! allows for well behaved errors defined elsewhere.
-assert.fail = fail;
-
-// 4. Pure assertion tests whether a value is truthy, as determined
-// by !!guard.
-// assert.ok(guard, message_opt);
-// This statement is equivalent to assert.equal(true, guard,
-// message_opt);. To test strictly for the value true, use
-// assert.strictEqual(true, guard, message_opt);.
-
-assert.ok = function ok(value, message) {
- if (!!!value) fail(value, true, message, "==", assert.ok);
-};
-
-// 5. The equality assertion tests shallow, coercive equality with
-// ==.
-// assert.equal(actual, expected, message_opt);
-
-assert.equal = function equal(actual, expected, message) {
- if (actual != expected) fail(actual, expected, message, "==", assert.equal);
-};
-
-// 6. The non-equality assertion tests for whether two objects are not equal
-// with != assert.notEqual(actual, expected, message_opt);
-
-assert.notEqual = function notEqual(actual, expected, message) {
- if (actual == expected) {
- fail(actual, expected, message, "!=", assert.notEqual);
- }
-};
-
-// 7. The equivalence assertion tests a deep equality relation.
-// assert.deepEqual(actual, expected, message_opt);
-
-assert.deepEqual = function deepEqual(actual, expected, message) {
- if (!_deepEqual(actual, expected)) {
- fail(actual, expected, message, "deepEqual", assert.deepEqual);
- }
-};
-
-function _deepEqual(actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
-}
-
-function isUndefinedOrNull (value) {
- return value === null || value === undefined;
-}
-
-function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
-}
-
-function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return _deepEqual(a, b);
- }
- try{
- var ka = _keys(a),
- kb = _keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!_deepEqual(a[key], b[key] ))
- return false;
- }
- return true;
-}
-
-// 8. The non-equivalence assertion tests for any deep inequality.
-// assert.notDeepEqual(actual, expected, message_opt);
-
-assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
- if (_deepEqual(actual, expected)) {
- fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual);
- }
-};
-
-// 9. The strict equality assertion tests strict equality, as determined by ===.
-// assert.strictEqual(actual, expected, message_opt);
-
-assert.strictEqual = function strictEqual(actual, expected, message) {
- if (actual !== expected) {
- fail(actual, expected, message, "===", assert.strictEqual);
- }
-};
-
-// 10. The strict non-equality assertion tests for strict inequality, as determined by !==.
-// assert.notStrictEqual(actual, expected, message_opt);
-
-assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
- if (actual === expected) {
- fail(actual, expected, message, "!==", assert.notStrictEqual);
- }
-};
-
-function _throws (shouldThrow, block, err, message) {
- var exception = null,
- threw = false,
- typematters = true;
-
- message = message || "";
-
- //handle optional arguments
- if (arguments.length == 3) {
- if (typeof(err) == "string") {
- message = err;
- typematters = false;
- }
- } else if (arguments.length == 2) {
- typematters = false;
- }
-
- try {
- block();
- } catch (e) {
- threw = true;
- exception = e;
- }
-
- if (shouldThrow && !threw) {
- fail( "Missing expected exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if (!shouldThrow && threw && typematters && exception instanceof err) {
- fail( "Got unwanted exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if ((shouldThrow && threw && typematters && !(exception instanceof err)) ||
- (!shouldThrow && threw)) {
- throw exception;
- }
-};
-
-// 11. Expected to throw an error:
-// assert.throws(block, Error_opt, message_opt);
-
-assert.throws = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [true].concat(pSlice.call(arguments)));
-};
-
-// EXTENSION! This is annoying to write outside this module.
-assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [false].concat(pSlice.call(arguments)));
-};
-
-assert.ifError = function (err) { if (err) {throw err;}};
-})(assert);
-(function(exports){
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-
-
-/**
- * Creates assertion objects representing the result of an assert call.
- * Accepts an object or AssertionError as its argument.
- *
- * @param {object} obj
- * @api public
- */
-
-exports.assertion = function (obj) {
- return {
- method: obj.method || '',
- message: obj.message || (obj.error && obj.error.message) || '',
- error: obj.error,
- passed: function () {
- return !this.error;
- },
- failed: function () {
- return Boolean(this.error);
- }
- };
-};
-
-/**
- * Creates an assertion list object representing a group of assertions.
- * Accepts an array of assertion objects.
- *
- * @param {Array} arr
- * @param {Number} duration
- * @api public
- */
-
-exports.assertionList = function (arr, duration) {
- var that = arr || [];
- that.failures = function () {
- var failures = 0;
- for (var i=0; i(' +
- '' + assertions.failures() + ', ' +
- '' + assertions.passes() + ', ' +
- assertions.length +
- ')';
- test.className = assertions.failures() ? 'fail': 'pass';
- test.appendChild(strong);
-
- var aList = document.createElement('ol');
- aList.style.display = 'none';
- test.onclick = function () {
- var d = aList.style.display;
- aList.style.display = (d == 'none') ? 'block': 'none';
- };
- for (var i=0; i' + (a.error.stack || a.error) + '';
- li.className = 'fail';
- }
- else {
- li.innerHTML = a.message || a.method || 'no message';
- li.className = 'pass';
- }
- aList.appendChild(li);
- }
- test.appendChild(aList);
- tests.appendChild(test);
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
-
- var failures = assertions.failures();
- banner.className = failures ? 'fail': 'pass';
-
- result.innerHTML = 'Tests completed in ' + duration +
- ' milliseconds. ' +
- assertions.passes() + ' assertions of ' +
- '' + assertions.length + ' passed, ' +
- assertions.failures() + ' failed.';
- }
- });
-};
-})(reporter);
-nodeunit = core;
-nodeunit.assert = assert;
-nodeunit.reporter = reporter;
-nodeunit.run = reporter.run;
-return nodeunit; })();
diff --git a/AtmosJS/package.json b/AtmosJS/package.json
deleted file mode 100644
index ef22b4d..0000000
--- a/AtmosJS/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "author": "Chris Arnett ",
- "name": "atmos",
- "description": "Connector for EMC Atmos cloud storage",
- "version": "2.1.1",
- "homepage": "http://code.google.com/p/atmos-js",
- "repository": {
- "url": ""
- },
- "engines": {
- "node": ">=v0.10.0"
- },
- "dependencies": {
- "xmldom": ">=0.1.14",
- "xmlhttprequest": ">=1.4.0"
- },
- "devDependencies": {
- "nodeunit": ">=0.7.0"
- }
-}
diff --git a/AtmosJS/readme.txt b/AtmosJS/readme.txt
deleted file mode 100644
index 4d09a28..0000000
--- a/AtmosJS/readme.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-
-= Dependencies when running in a browser =
- * JavaScript 1.5 (used for maximum compatibility, see: http://en.wikipedia.org/wiki/JavaScript#Versions)
- * Some libraries from Crypto-JS (see the lib-min folder)
- * crypto-*.js
-
-= Dependencies when running in Node.js (npm packages) =
- * xmldom
- * xmlhttprequest
- * nodeunit (for testing only)
-
-= Optional Components =
- * nodeunit (see nodeunit folder) - used for optional unit tests
-
-
\ No newline at end of file
diff --git a/AtmosJS/samples/node/atmos-config.js b/AtmosJS/samples/node/atmos-config.js
deleted file mode 100644
index 5fac261..0000000
--- a/AtmosJS/samples/node/atmos-config.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-
- Copyright (c) 2011, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-var atmosConfig = {
- host: "api.atmosonline.com", // hostname/ip of access node
- protocol: "http:", // either http: or https:
- uid: "ab105326496a4228add95d20306030fd/CONNEAABCF7F31DDF0F7", // the subtenant/uid
- secret: "ra15Bu1Gk2AX5QV1K7iC9scG/OM=", // the secret key
- enableUtf8: true // enable if you're connecting to 1.4.1+
-};
-
-if ( typeof(global) != 'undefined' ) {
- global.atmosConfig = atmosConfig;
-}
diff --git a/AtmosJS/samples/node/create-object.js b/AtmosJS/samples/node/create-object.js
deleted file mode 100644
index 5af1a84..0000000
--- a/AtmosJS/samples/node/create-object.js
+++ /dev/null
@@ -1,19 +0,0 @@
-AtmosJS = require( '../../atmos-min-2.1.1.js' );
-AtmosRest = AtmosJS.AtmosRest;
-ListOptions = AtmosJS.ListOptions;
-AtmosRange = AtmosJS.AtmosRange;
-AclEntry = AtmosJS.AclEntry;
-Acl = AtmosJS.Acl;
-
-require( './atmos-config.js' );
-
-atmos = new AtmosRest( atmosConfig );
-
-atmos.info( "calling createObject" ); // logs to console
-
-atmos.createObject( null, null, null, null, "Hello World!", "text/plain", function( result ) {
- if ( result.successful ) {
- var objectId = result.value;
- atmos.info( "Object created. id=" + objectId );
- }
-} );
diff --git a/AtmosJS/samples/node/delete-object.js b/AtmosJS/samples/node/delete-object.js
deleted file mode 100644
index 9a0726c..0000000
--- a/AtmosJS/samples/node/delete-object.js
+++ /dev/null
@@ -1,26 +0,0 @@
-AtmosJS = require( '../../atmos-min-2.1.1.js' );
-AtmosRest = AtmosJS.AtmosRest;
-ListOptions = AtmosJS.ListOptions;
-AtmosRange = AtmosJS.AtmosRange;
-AclEntry = AtmosJS.AclEntry;
-Acl = AtmosJS.Acl;
-
-require( './atmos-config.js' );
-
-atmos = new AtmosRest( atmosConfig );
-
-atmos.info( "calling getServiceInformation" ); // logs to console
-
-var objectId = "4ee696e4a41f549804f0b909b6c90a04f569598cbd8c";
-atmos.deleteObject( objectId, function( result ) {
- var httpCode = result.httpCode; // always available
- var httpMessage = result.httpMessage; // always available
- if ( result.successful ) {
- atmos.info( "Object deleted." );
- } else {
- var errorCode = result.errorCode; // available on error
- var errorMessage = result.errorMessage; // available on error
-
- atmos.error( "Error occurred (httpCode: " + httpCode + ", httpMessage: " + httpMessage + ", atmosCode: " + errorCode + ", atmosMessage: " + errorMessage );
- }
-} );
\ No newline at end of file
diff --git a/AtmosJS/samples/node/get-server-info.js b/AtmosJS/samples/node/get-server-info.js
deleted file mode 100644
index 051f40a..0000000
--- a/AtmosJS/samples/node/get-server-info.js
+++ /dev/null
@@ -1,19 +0,0 @@
-AtmosJS = require( '../../atmos-min-2.1.1.js' );
-AtmosRest = AtmosJS.AtmosRest;
-ListOptions = AtmosJS.ListOptions;
-AtmosRange = AtmosJS.AtmosRange;
-AclEntry = AtmosJS.AclEntry;
-Acl = AtmosJS.Acl;
-
-require( './atmos-config.js' );
-
-atmos = new AtmosRest( atmosConfig );
-
-atmos.info( "calling getServiceInformation" ); // logs to console
-
-atmos.getServiceInformation( function( result ) {
- if ( result.successful ) {
- var serverInfo = result.value;
- atmos.info( "Connected to Atmos version " + serverInfo.version + " on host " + atmos.atmosConfig.host );
- }
-} );
diff --git a/AtmosJS/samples/node/read-object.js b/AtmosJS/samples/node/read-object.js
deleted file mode 100644
index 892c6fa..0000000
--- a/AtmosJS/samples/node/read-object.js
+++ /dev/null
@@ -1,20 +0,0 @@
-AtmosJS = require( '../../atmos-min-2.1.1.js' );
-AtmosRest = AtmosJS.AtmosRest;
-ListOptions = AtmosJS.ListOptions;
-AtmosRange = AtmosJS.AtmosRange;
-AclEntry = AtmosJS.AclEntry;
-Acl = AtmosJS.Acl;
-
-require( './atmos-config.js' );
-
-atmos = new AtmosRest( atmosConfig );
-
-atmos.info( "calling getServiceInformation" ); // logs to console
-
-var objectId = "4ee696e4a41f549804f0b909b6c90a04f569598cbd8c";
-atmos.readObject( objectId, null, function( result ) {
- if ( result.successful ) {
- var data = result.data;
- atmos.info( "Object read. Contents:\n" + data );
- }
-} );
\ No newline at end of file
diff --git a/AtmosJS/src/AccessToken.js b/AtmosJS/src/AccessToken.js
deleted file mode 100644
index 225d72b..0000000
--- a/AtmosJS/src/AccessToken.js
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-if ( typeof(require) == 'function' && typeof(AtmosUtil) == 'undefined' ) AtmosUtil = require( './AtmosUtil' ).AtmosUtil;
-/**
- * Represents an anonymous access token
- * @param {string} tokenId the identifier of the token
- * @param {AccessTokenPolicy} tokenPolicy the policy of the token
- * @param {string=} objectPath the path of the object targeted by the token (if using namespace)
- * @param {string=} objectId the OID of the object targeted by the token
- * @param {Acl=} acl the ACL assigned to an uploaded object via this access token
- * @constructor
- */
-AccessToken = function( tokenId, tokenPolicy, objectPath, objectId, acl ) {
- this.tokenId = tokenId;
- this.tokenPolicy = tokenPolicy;
- this.objectPath = objectPath;
- this.objectId = objectId;
- this.acl = acl;
-};
-
-/**
- * Returns a new AccessToken object parsed from the specified XML DOM node
- * @param {Node} tokenNode an XML node containing the token's XML representation ()
- * @return {AccessToken}
- */
-AccessToken.fromNode = function( tokenNode ) {
- var token = new AccessToken();
-
- var node, useracl, groupacl;
- if ( node = AtmosUtil.getChildByTagName( tokenNode, 'access-token-id' ) )
- token.tokenId = AtmosUtil.getTextContent( node );
- if ( node = AtmosUtil.getChildByTagName( tokenNode, 'path' ) )
- token.objectPath = AtmosUtil.getTextContent( node );
- if ( node = AtmosUtil.getChildByTagName( tokenNode, 'object-id' ) )
- token.objectId = AtmosUtil.getTextContent( node );
- if ( node = AtmosUtil.getChildByTagName( tokenNode, 'useracl' ) )
- useracl = AccessToken._parseAclEntries( AtmosUtil.getTextContent( node ) );
- if ( node = AtmosUtil.getChildByTagName( tokenNode, 'groupacl' ) )
- groupacl = AccessToken._parseAclEntries( AtmosUtil.getTextContent( node ) );
-
- if ( useracl || groupacl )
- token.acl = new Acl( useracl, groupacl );
-
- token.tokenPolicy = AccessTokenPolicy.fromNode( tokenNode );
-
- return token;
-};
-
-/**
- * Parses ACL entries from a comma-delimited string
- * @param {string} text a comma-delimited string representing a user or group ACL
- */
-AccessToken._parseAclEntries = function( text ) {
- var aclEntries = [];
- var grants = text.split( / *, */ );
- for ( var i = 0; i < grants.length; i++ ) {
- var nvpair = grants[i].split( "=", 2 );
- var grantee = nvpair[0];
- var permission = nvpair[1];
-
- grantee = grantee.trim();
-
- // Currently, the server returns "FULL" instead of "FULL_CONTROL".
- // For consistency, change this to value use in the request
- if ( "FULL" === permission ) {
- permission = AclEntry.ACL_PERMISSIONS.FULL_CONTROL;
- }
-
- aclEntries[i] = new AclEntry( grantee, permission );
- }
- return aclEntries;
-};
-
-/**
- * Represents a public access token policy
- * @param {Date=} expiration the time at which this access token expires
- * @param {number=} maxUploads the maximum number of times this access token can be used to upload an object
- * @param {number=} maxDownloads the maximum number of times this access token can be used to download an object
- * @param {Array.=} sourceAllowList a list of source IPs (possibly with subnets) that are allowed to use this
- * access token
- * @param {Array.=} sourceDenyList a list of source IPs (possibly with subnets) that are not allowed to use this
- * access token
- * @param {number=} minSize the minimum size to accept for an uploaded object
- * @param {number=} maxSize the maximum size to accept for an uploaded object
- * @param {Array.=} formFieldList a list of form field criteria that must be met for an upload
- * to be accepted
- * @constructor
- */
-AccessTokenPolicy = function( expiration, maxUploads, maxDownloads, sourceAllowList, sourceDenyList, minSize, maxSize, formFieldList ) {
- this.expiration = expiration;
- this.maxUploads = maxUploads;
- this.maxDownloads = maxDownloads;
- this.sourceAllowList = sourceAllowList;
- this.sourceDenyList = sourceDenyList;
- this.minSize = minSize;
- this.maxSize = maxSize;
- this.formFieldList = formFieldList;
-};
-
-/**
- * Returns a new AccessTokenPolicy object parsed from the specified XML DOM node
- * @param {Node} policyNode an XML node containing the policy's XML representation
- * @return {AccessTokenPolicy}
- */
-AccessTokenPolicy.fromNode = function( policyNode ) {
- var policy = new AccessTokenPolicy();
- var node, nodes;
- if ( node = AtmosUtil.getChildByTagName( policyNode, 'expiration' ) )
- policy.expiration = AtmosUtil.parseIso8601Date( AtmosUtil.getTextContent( node ) );
- if ( node = AtmosUtil.getChildByTagName( policyNode, 'max-uploads' ) )
- policy.maxUploads = parseInt( AtmosUtil.getTextContent( node ) );
- if ( node = AtmosUtil.getChildByTagName( policyNode, 'max-downloads' ) )
- policy.maxDownloads = parseInt( AtmosUtil.getTextContent( node ) );
- if ( node = AtmosUtil.getChildByTagName( policyNode, 'source' ) ) {
- if ( nodes = AtmosUtil.getChildrenByTagName( node, 'allow' ) ) {
- policy.sourceAllowList = [];
- nodes.forEach( function( allowNode ) {
- policy.sourceAllowList.push( AtmosUtil.getTextContent( allowNode ) );
- } );
- }
- if ( nodes = AtmosUtil.getChildrenByTagName( node, 'disallow' ) ) {
- policy.sourceDenyList = [];
- nodes.forEach( function( denyNode ) {
- policy.sourceDenyList.push( AtmosUtil.getTextContent( denyNode ) );
- } );
- }
- }
- if ( node = AtmosUtil.getChildByTagName( policyNode, 'content-length-range' ) ) {
- policy.minSize = parseInt( node.getAttribute( 'from' ) );
- policy.maxSize = parseInt( node.getAttribute( 'to' ) );
- }
- if ( nodes = AtmosUtil.getChildrenByTagName( policyNode, 'form-field' ) ) {
- policy.formFieldList = [];
- nodes.forEach( function( fieldNode ) {
- policy.formFieldList.push( AccessTokenFormField.fromElement( fieldNode ) );
- } );
- }
- return policy;
-};
-
-/**
- * Generates the XML representation of this token policy
- * @return {Document}
- */
-AccessTokenPolicy.prototype.toDocument = function() {
- var doc = AtmosUtil.createDocument();
- var policyNode = AtmosUtil.createElement( doc, 'policy' );
- doc.appendChild( policyNode );
-
- // expiration
- if ( this.expiration ) policyNode.appendChild( AtmosUtil.createElement( doc, 'expiration', this.expiration.toISOString() ) );
-
- // max uploads/downloads
- if ( this.maxUploads ) policyNode.appendChild( AtmosUtil.createElement( doc, 'max-uploads', this.maxUploads ) );
- if ( this.maxDownloads ) policyNode.appendChild( AtmosUtil.createElement( doc, 'max-downloads', this.maxDownloads ) );
-
- // source
- if ( (this.sourceAllowList && this.sourceAllowList.length)
- || (this.sourceDenyList && this.sourceDenyList.length) ) {
- var source = AtmosUtil.createElement( doc, 'source' );
- policyNode.appendChild( source );
- if ( this.sourceAllowList ) {
- this.sourceAllowList.forEach( function( allowItem ) {
- source.appendChild( AtmosUtil.createElement( doc, 'allow', allowItem ) );
- } );
- }
- if ( this.sourceDenyList ) {
- this.sourceDenyList.forEach( function( denyItem ) {
- source.appendChild( AtmosUtil.createElement( doc, 'disallow', denyItem ) );
- } );
- }
- }
-
- // content-length range
- if ( typeof(this.minSize) == 'number' || typeof(this.maxSize) == 'number' ) {
- var attributes = {};
- if ( typeof(this.minSize) == 'number' ) attributes.from = this.minSize;
- if ( typeof(this.maxSize) == 'number' ) attributes.to = this.maxSize;
- policyNode.appendChild( AtmosUtil.createElement( doc, 'content-length-range', null, attributes ) );
- }
-
- // form fields
- if ( this.formFieldList ) {
- this.formFieldList.forEach( function( field ) {
- policyNode.appendChild( field.toElement( doc ) );
- } );
- }
- return doc;
-};
-
-/**
- * Represents a form field criteria for an anonymous upload
- * @param {string} name the name of the form field
- * @param {boolean=} optional whether the field is optional
- * @param {string=} eq the field must match this value to be accepted
- * @param {string=} startsWith the field must start with this value to be accepted
- * @param {string=} endsWith the field must end with this value to be accepted
- * @param {string=} contains the field must contain this value to be accepted
- * @param {string=} matches the field must match this regular expression to be accepted
- * @constructor
- */
-AccessTokenFormField = function( name, optional, eq, startsWith, endsWith, contains, matches ) {
- this.name = name;
- this.optional = optional;
- this.eq = eq;
- this.startsWith = startsWith;
- this.endsWith = endsWith;
- this.contains = contains;
- this.matches = matches;
-};
-
-/**
- * Returns a new AccessTokenFormField objectd parsed from the specified XML element
- * @param {Element} element an XML element representing a form field
- * @return {AccessTokenFormField}
- */
-AccessTokenFormField.fromElement = function( element ) {
- var field = new AccessTokenFormField( element.getAttribute( 'name' ), element.getAttribute( 'optional' ) ? true : false );
- var child;
- if ( child = AtmosUtil.getChildByTagName( element, 'eq' ) )
- field.eq = AtmosUtil.getTextContent( child );
- if ( child = AtmosUtil.getChildByTagName( element, 'starts-with' ) )
- field.startsWith = AtmosUtil.getTextContent( child );
- if ( child = AtmosUtil.getChildByTagName( element, 'ends-with' ) )
- field.endsWith = AtmosUtil.getTextContent( child );
- if ( child = AtmosUtil.getChildByTagName( element, 'contains' ) )
- field.contains = AtmosUtil.getTextContent( child );
- if ( child = AtmosUtil.getChildByTagName( element, 'matches' ) )
- field.matches = AtmosUtil.getTextContent( child );
-
- return field;
-};
-
-/**
- * Generates the XMLElement representation of this token policy
- * @param {Document} doc the document in which to create the element
- * @return {Element}
- */
-AccessTokenFormField.prototype.toElement = function( doc ) {
- var field = AtmosUtil.createElement( doc, 'form-field', null, {name: this.name} );
- if ( this.optional ) field.setAttribute( 'optional', 'true' );
- if ( this.eq )
- field.appendChild( AtmosUtil.createElement( doc, 'eq', this.eq ) );
- else if ( this.startsWith )
- field.appendChild( AtmosUtil.createElement( doc, 'starts-with', this.startsWith ) );
- else if ( this.endsWith )
- field.appendChild( AtmosUtil.createElement( doc, 'ends-with', this.endsWith ) );
- else if ( this.contains )
- field.appendChild( AtmosUtil.createElement( doc, 'contains', this.contains ) );
- else if ( this.matches )
- field.appendChild( AtmosUtil.createElement( doc, 'matches', this.matches ) );
-
- return field;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AccessToken = AccessToken;
- exports.AccessTokenPolicy = AccessTokenPolicy;
- exports.AccessTokenFormField = AccessTokenFormField;
-}
diff --git a/AtmosJS/src/Acl.js b/AtmosJS/src/Acl.js
deleted file mode 100644
index 523f06e..0000000
--- a/AtmosJS/src/Acl.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * ACL objects contain two properties: userEntries and groupEntries
- * Each of those properties should be an Array of AclEntry
- * objects.
- * @param {Array.} userEntries list of user entries
- * @param {Array.} groupEntries list of group entries
- * @constructor
- */
-Acl = function( userEntries, groupEntries ) {
- this.userEntries = userEntries;
- this.groupEntries = groupEntries;
-};
-
-/**
- * Defines an entry on an ACL (grantee -> Permission). Use of this class is optional, you
- * can simply define with JSON, e.g.
- * [ {key:AclEntry.GROUPS.OTHER,value:AclEntry.ACL_PERMISSIONS.READ} ]
- * @param {string} key name of the user or group
- * @param {string} value permission granted to the user or group
- * @constructor
- */
-AclEntry = function( key, value ) {
- this.key = key;
- this.value = value;
-};
-
-/**
- * Predefined permissions you can grant
- * @static
- */
-AclEntry.ACL_PERMISSIONS = { READ: "READ", WRITE: "WRITE", FULL_CONTROL: "FULL_CONTROL", NONE: "NONE" };
-/**
- * Predefined groups
- * @static
- */
-AclEntry.GROUPS = { OTHER: "other" };
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.Acl = Acl;
- exports.AclEntry = AclEntry;
-}
diff --git a/AtmosJS/src/AtmosConfig.js b/AtmosJS/src/AtmosConfig.js
deleted file mode 100644
index d5ed9e9..0000000
--- a/AtmosJS/src/AtmosConfig.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * Defines configuration parameters for an AtmosRest client.
- * @param {string} uid (required) the Atmos UID for the connection
- * @param {string} secret (required) the Atmos shared secret key for the connection
- * @param {boolean=} enableUtf8 (optional) set to true to enable UTF8 non-latin character support in metadata values.
- * NOTE: this feature must be supported by your Atmos version (check AtmosServiceInfo.utf8).
- * @param {boolean=} enableDebug (optional) set to true to enable log output for debugging (default is false).
- * @param {string=} protocol (optional) for node.js or if CORS is enabled on the endpoint.
- * the protocol to use when connecting to the endpoint (HTTP or HTTPS)
- * @param {string=} host (optional) for node.js or if CORS is enabled on the endpoint. the endpoint host.
- * @param {number=} port (optional) for node.js or if CORS is enabled on the endpoint. the endpoint port.
- * @constructor
- */
-AtmosConfig = function(uid, secret, enableUtf8, enableDebug, protocol, host, port) {
- this.uid = uid;
- this.secret = secret;
- this.enableUtf8 = enableUtf8;
- this.enableDebug = enableDebug;
- this.protocol = protocol;
- this.host = host;
- this.port = port;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AtmosConfig = AtmosConfig;
-}
diff --git a/AtmosJS/src/AtmosRest.js b/AtmosJS/src/AtmosRest.js
deleted file mode 100644
index 166823e..0000000
--- a/AtmosJS/src/AtmosRest.js
+++ /dev/null
@@ -1,1736 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-var isNodejs = (typeof(require) == 'function' );
-if ( isNodejs ) {
- crypto = require( 'crypto' );
- XMLHttpRequest = require( 'xmlhttprequest' ).XMLHttpRequest;
- if ( typeof(AtmosUtil) == 'undefined' ) AtmosUtil = require( './AtmosUtil' ).AtmosUtil;
-}
-
-/**
- * Provides access to the EMC Atmos REST API through JavaScript.
- * Constructs a new AtmosRest object.
- *
- * @param {AtmosConfig} atmosConfig the Atmos configuration object.
- * @constructor
- */
-AtmosRest = function( atmosConfig ) {
- this.atmosConfig = atmosConfig;
-
- this.info( "AtmosRest loaded" );
-};
-
-// release version
-/** @define {string} */
-var ATMOS_REST_VERSION = '0.1';
-AtmosRest.version = ATMOS_REST_VERSION;
-
-/** @define {boolean} */
-var ATMOS_REST_COMPILED = false;
-AtmosRest.compiled = ATMOS_REST_COMPILED;
-
-// counters
-AtmosRest.iframeCount = 0;
-
-/**
- * The URI context for the REST service. Defaults to "/rest"
- * @type {string}
- */
-AtmosRest.prototype.context = "/rest";
-
-////////////////////
-// Public Methods //
-////////////////////
-
-/**
- * Returns the information about the Atmos REST web service
- * @param {function} callback the completion callback (both error and success). In the callback, result.value will
- * reference an AtmosServiceInfo object which contains service information such as features and version
- */
-AtmosRest.prototype.getServiceInformation = function( callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- method: 'GET',
- uri: this.context + '/service',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var version = "n/a";
-
- // looking for /Version/Atmos (X.X.X)
- var doc = me._getXmlDoc( xhr );
- var versionNodes = doc.getElementsByTagName( "Version" );
- if ( versionNodes.length ) version = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( versionNodes[0], "Atmos" ) );
-
- result.value = new AtmosServiceInfo( version, false, false, false, false, false );
- result.value.loadFeaturesFromHeader( xhr.getResponseHeader( "x-emc-features" ),
- xhr.getResponseHeader( "x-emc-support-utf8" ) );
- },
- complete: callback
- } );
-};
-
-/**
- * Creates an object in Atmos
- * @param {Acl} acl an Acl for the new object. If null, the object will get the default Acl.
- * @param {Object} meta regular Metadata for the new object. May be null for no regular metadata.
- * @param {Object} listableMeta listable Metadata for the new object. May be null for no listable metadata.
- * @param {string} form the form element that contains the file(s) to upload. Either form or data must be specified.
- * NOTE: multipart forms must be supported by your Atmos version (check AtmosServiceInfo.browsercompat).
- * @param {string|File} data the data for the new object (can be a String, Blob or File). Either form or data must be specified
- * @param {string} mimeType the mimeType for the new object. If null, the object will be assigned application/octet-stream.
- * Leave blank if form is present (mime type will be extracted from multipart data)
- * @param {function} successCallback the callback for when the function completes. Should have the signature function(result)
- * where result will be an AtmosResult object. The created Object ID will be in the value field of the result object.
- * @param {function=} progressCallback (optional) the callback for progress updates (i.e. status bar)
- */
-AtmosRest.prototype.createObject = function( acl, meta, listableMeta, form, data, mimeType, successCallback, progressCallback ) {
- var headers = {};
- var me = this;
-
- this._addAclHeaders( acl, headers );
- this._addMetadataHeaders( meta, headers, false );
- this._addMetadataHeaders( listableMeta, headers, true );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + '/objects',
- method: 'POST',
- headers: headers,
- data: data,
- mimeType: mimeType,
- progress: progressCallback,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processCreateObjectResult( result, xhr );
- },
- complete: successCallback,
- form: form
- } );
-};
-
-/**
- * Creates an object in Atmos on the path provided.
- *
- * @param {string} path the namespace path in Atmos (must start with a slash)
- * @param {Acl} acl an Acl for the new object. If null, the object will get the default Acl.
- * @param {Object} meta regular Metadata for the new object. May be null for no regular metadata.
- * @param {Object} listableMeta listable Metadata for the new object. May be null for no listable metadata.
- * @param {Element} form the form element that contains the file(s) to upload. Either form or data must be specified
- * NOTE: multipart forms must be supported by your Atmos version (check AtmosServiceInfo.browsercompat).
- * @param {string|File} data the data for the new object (can be a String, Blob or File). Either form or data must be specified
- * @param {string} mimeType the mimeType for the new object. If null, the object will be assigned application/octet-stream.
- * Leave blank if form is present (mime type will be extracted from multipart data)
- * @param {function} successCallback the callback for when the function completes. Should have the signature function(result)
- * where result will be an AtmosResult object. The created Object ID will be in the value field of the result object.
- * @param {function=} progressCallback the (optional) callback for progress updates (i.e. status bar)
- */
-AtmosRest.prototype.createObjectOnPath = function( path, acl, meta, listableMeta, form, data, mimeType, successCallback, progressCallback ) {
- if ( !AtmosRest.objectPathMatch.test( path ) ) {
- throw "The path '" + path + "' is not valid";
- }
- var headers = {};
- var me = this;
-
- this._addAclHeaders( acl, headers );
- this._addMetadataHeaders( meta, headers, false );
- this._addMetadataHeaders( listableMeta, headers, true );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( path ),
- method: 'POST',
- headers: headers,
- data: data,
- mimeType: mimeType,
- progress: progressCallback,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processCreateObjectResult( result, xhr );
- },
- complete: successCallback,
- form: form
- } );
-};
-
-/**
- * Reads the contents of an object from Atmos
- * @param {string} id the object identifier (either an object path or an object id)
- * @param {AtmosRange} range the range of the object to read, pass null to read the entire object.
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's content will be returned in the data property of the result object.
- */
-AtmosRest.prototype.readObject = function( id, range, callback ) {
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ),
- method: 'GET',
- headers: {},
- range: range,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- result.data = xhr.responseText;
- },
- complete: callback
- } );
-};
-
-/**
- * Updates an object in Atmos with the given ID.
- *
- * @param {string} id the object ID or namespace path in Atmos.
- * @param {Acl} acl an Acl for the object. May be null for no updates.
- * @param {Object} meta regular Metadata for the object. May be null for no updates.
- * @param {Object} listableMeta listable Metadata for the object. May be null for no updates.
- * @param {string} form the form element that contains the file(s) to upload. Either form or data must be specified
- * NOTE: multipart forms must be supported by your Atmos version (check AtmosServiceInfo.browsercompat).
- * @param {string|File} data the data for the new object (can be a String, Blob or File). Either form or data must be specified
- * @param {AtmosRange} range the range of the object to update, pass null to replace the entire object or if a form is used.
- * @param {string} mimeType the mimeType for the new object. If null, the object will be assigned application/octet-stream.
- * Leave blank if form is present (mime type will be extracted from multipart data)
- * @param {function} successCallback the callback for when the function completes. Should have the signature function(result)
- * where result will be an AtmosResult object. The result of this call will only contain status information.
- * @param {function=} progressCallback the (optional) callback for progress updates (i.e. status bar)
- */
-AtmosRest.prototype.updateObject = function( id, acl, meta, listableMeta, form, data, range, mimeType, successCallback, progressCallback ) {
- var headers = {};
-
- this._addAclHeaders( acl, headers );
- this._addMetadataHeaders( meta, headers, false );
- this._addMetadataHeaders( listableMeta, headers, true );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ),
- method: 'PUT',
- headers: headers,
- data: data,
- mimeType: mimeType,
- range: range,
- progress: progressCallback,
- complete: successCallback,
- form: form
- } );
-};
-
-/**
- * Deletes an object from Atmos.
- * @param {string} id an object identifier (either an object path or object id)
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.deleteObject = function( id, callback ) {
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ),
- method: 'DELETE',
- headers: {},
- complete: callback
- } );
-};
-
-/**
- * Lists the versions of an object.
- * @param {string} id the id of the object (either an object path or object id)
- * @param {function} callback the completion callback (both error and success). On success, a list of object IDs will
- * be in result.value
- */
-AtmosRest.prototype.listVersions = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?versions',
- method: 'GET',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- result.value = me._parseObjectVersions( xhr );
- },
- complete: callback
- } );
-};
-
-/**
- * Creates a new immutable version of an object.
- * @param {string} id the id of the object to version (either an object path or object id)
- * @param {function=} callback the completion callback (both error and success). On success, the ID of the newly created
- * version will be in result.value
- */
-AtmosRest.prototype.versionObject = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + "?versions",
- method: 'POST',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processCreateObjectResult( result, xhr );
- },
- complete: callback
- } );
-};
-
-/**
- * Restores a version of an object to the base version (i.e. "promote" an
- * old version to the current version).
- * @param {string} id Base object ID (target of the restore)
- * @param {string} vId Version object ID to restore
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.restoreVersion = function( id, vId, callback ) {
- var headers = {};
-
- // Version to promote
- headers["x-emc-version-oid"] = vId;
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?versions',
- method: 'PUT',
- headers: headers,
- complete: callback
- } );
-};
-
-/**
- * Deletes a version of an object from the cloud.
- * @param {string} vId the object ID of the version of the object to delete.
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.deleteVersion = function( vId, callback ) {
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( vId ) + '?versions',
- method: 'DELETE',
- headers: {},
- complete: callback
- } );
-};
-
-/**
- * Renames a file or directory within the namespace.
- * @param {string} oldPath The file or directory to rename
- * @param {string} newPath The new path for the file or directory
- * @param {boolean} force If true, the desination file or
- * directory will be overwritten. Directories must be empty to be
- * overwritten. Also note that overwrite operations on files are
- * not synchronous; a delay may be required before the object is
- * available at its destination.
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.rename = function( oldPath, newPath, force, callback ) {
- if ( !AtmosRest.objectPathMatch.test( newPath ) ) {
- throw "The path '" + newPath + "' is not valid";
- }
- var headers = {};
-
- headers["x-emc-path"] = this.atmosConfig.enableUtf8 ? encodeURIComponent( newPath.substr( 1 ) ) : newPath.substr( 1 );
- if ( force ) headers["x-emc-force"] = "true";
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( oldPath ) + "?rename",
- method: 'POST',
- headers: headers,
- complete: callback
- } );
-};
-
-/**
- * Creates a string to be used as the disposition string when creating a shareable URL with disposition (download link).
- * Example code:
- * var futureDate = new Date(...); // date in future
- * var disposition = atmosRest.createAttachmentDisposition(); // fileName optional for namespace API (required for object API)
- * var url = atmosRest.getShareableUrl( "/my/object", futureDate, disposition ); // URL response will contain a Content-Disposition header
- *
- * NOTE: this feature must be supported by your Atmos version (check AtmosServiceInfo.browsercompat).
- * @param {string=} fileName
- */
-AtmosRest.prototype.createAttachmentDisposition = function( fileName ) {
- if ( fileName ) return "attachment; filename*=" + encodeURIComponent( "UTF-8''" + fileName );
- else return "attachment";
-};
-
-/**
- * Creates a shareable URL that anyone (globally) can access.
- *
- * @param {string} id the object ID or path for which to generate the URL
- * @param {Date} expirationDate the expiration date of the URL (as
- * @param {string=} disposition the content-disposition that should be specified in the response header for the shareable
- * URL. NOTE: this feature must be supported by your Atmos version (check AtmosServiceInfo.browsercompat).
- * @return {string} a URL that can be used to share the object's content
- */
-AtmosRest.prototype.getShareableUrl = function( id, expirationDate, disposition ) {
- if ( !expirationDate.getTime ) throw "expirationDate must be a Date object";
-
- var method = "GET";
- var path = this._getPath( id );
- var expires = Math.floor( expirationDate.getTime() / 1000 ); // convert to seconds
-
- // establish hash string for signing
- var hashString = method + "\n" + path.toLowerCase() + "\n" + this.atmosConfig.uid + "\n" + expires;
- if ( disposition ) hashString += "\n" + disposition;
- this.debug( "hash string:\n" + hashString );
-
- // sign hash string
- var signature = this._doSignature( hashString, this.atmosConfig.secret );
-
- // generate query string
- var query = "uid=" + encodeURIComponent( this.atmosConfig.uid );
- query += "&expires=" + expires;
- query += "&signature=" + encodeURIComponent( signature );
- if ( disposition ) query += "&disposition=" + encodeURIComponent( disposition );
-
- // compose URL
- var url = this._resolveUrl( this._encodeURI( path ), query );
- this.debug( "Shareable URL: " + url );
-
- return url;
-};
-
-/**
- * Returns an object's ACL
- * @param {string} id the object identifier (either an object path or an object id)
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's ACL will be returned in the value property of the result object.
- */
-AtmosRest.prototype.getAcl = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?acl',
- method: 'GET',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var userAcls = me._parseAclEntries( xhr.getResponseHeader( "x-emc-useracl" ) );
- var groupAcls = me._parseAclEntries( xhr.getResponseHeader( "x-emc-groupacl" ) );
- result.value = new Acl( userAcls, groupAcls );
- },
- complete: callback, x: 2
- } );
-};
-
-/**
- * Sets (overwrites) the ACL on the object.
- * @param {string} id the object identifier (either an object path or an object id)
- * @param {Acl} acl the new ACL for the object.
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.setAcl = function( id, acl, callback ) {
- var headers = {};
-
- this._addAclHeaders( acl, headers );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + "?acl",
- method: 'POST',
- headers: headers,
- complete: callback
- } );
-};
-
-/**
- * Returns the list of user metadata tags assigned to the object.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's non-listable tags will be in result.value.tags and the
- * listable tags will be in result.value.listableTags
- */
-AtmosRest.prototype.listUserMetadataTags = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?metadata/tags',
- method: 'GET',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var decode = xhr.getResponseHeader( "x-emc-utf8" ) == "true";
- result.value = {};
- var tagHeader = xhr.getResponseHeader( "x-emc-tags" );
- if ( tagHeader ) result.value.tags = me._listToArray( tagHeader, decode );
- var lTagHeader = xhr.getResponseHeader( "x-emc-listable-tags" );
- if ( lTagHeader ) result.value.listableTags = me._listToArray( lTagHeader, decode );
- },
- complete: callback
- } );
-};
-
-/**
- * Reads the user metadata for an object.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {Array} filter if not null, an array of strings defining which metadata tags should be returned.
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's metadata will be returned in result.value.meta and the
- * listable metadata will be returned in result.value.listableMeta.
- */
-AtmosRest.prototype.getUserMetadata = function( id, filter, callback ) {
- var headers = {};
- var me = this;
-
- if ( filter ) this._addTagHeader( filter, headers );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?metadata/user',
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var decode = xhr.getResponseHeader( "x-emc-utf8" ) == "true";
- result.value = {};
- result.value.meta = me._parseMetadata( xhr.getResponseHeader( "x-emc-meta" ), decode );
- result.value.listableMeta = me._parseMetadata( xhr.getResponseHeader( "x-emc-listable-meta" ), decode );
- },
- complete: callback
- } );
-};
-
-/**
- * Reads the system metadata for an object.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {Array} filter if not null, an array of strings defining which metadata tags should be returned.
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's system metadata will be returned in result.value.systemMeta (the mime type will be in
- * result.value.systemMeta.mimeType)
- */
-AtmosRest.prototype.getSystemMetadata = function( id, filter, callback ) {
- var headers = {};
- var me = this;
-
- if ( filter ) this._addTagHeader( filter, headers );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?metadata/system',
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var decode = xhr.getResponseHeader( "x-emc-utf8" ) == "true";
- result.value = {};
- result.value.systemMeta = me._parseMetadata( xhr.getResponseHeader( "x-emc-meta" ), decode );
- result.value.systemMeta.mimeType = xhr.getResponseHeader( "Content-Type" );
- },
- complete: callback
- } );
-};
-
-/**
- * Returns all of an object's user metadata and its ACL in one call.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's user metadata will be returned in result.value.meta, listable metadata will be in
- * result.value.listableMeta and its ACL will be in result.value.acl
- * NOTE: System metadata is included with user metadata here even though they exist in different namespaces. If you need
- * to differentiate between the two, use getSystemMetadata and getUserMetadata
- */
-AtmosRest.prototype.getAllMetadata = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ),
- method: 'HEAD',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var decode = xhr.getResponseHeader( "x-emc-utf8" ) == "true";
- result.value = {};
- result.value.meta = me._parseMetadata( xhr.getResponseHeader( "x-emc-meta" ), decode );
- result.value.listableMeta = me._parseMetadata( xhr.getResponseHeader( "x-emc-listable-meta" ), decode );
- var userAcls = me._parseAclEntries( xhr.getResponseHeader( "x-emc-useracl" ) );
- var groupAcls = me._parseAclEntries( xhr.getResponseHeader( "x-emc-groupacl" ) );
- result.value.acl = new Acl( userAcls, groupAcls );
- },
- complete: callback
- } );
-};
-
-/**
- * Get information about an object's state including
- * replicas, expiration, and retention.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the object's info will be returned in result.value (as an ObjectInfo object).
- */
-AtmosRest.prototype.getObjectInfo = function( id, callback ) {
- var me = this;
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?info',
- method: 'GET',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processObjectInfoResult( result, xhr );
- },
- complete: callback
- } );
-};
-
-/**
- * Sets the user metadata for an object.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {Object} meta a map of regular Metadata for the object. May be null or empty for no regular metadata.
- * @param {Object} listableMeta a map of listable Metadata for the object. May be null or empty for no listable metadata.
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.setUserMetadata = function( id, meta, listableMeta, callback ) {
- var headers = {};
-
- this._addMetadataHeaders( meta, headers, false );
- this._addMetadataHeaders( listableMeta, headers, true );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + "?metadata/user",
- method: 'POST',
- headers: headers,
- complete: callback
- } );
-};
-
-/**
- * Deletes metadata tags from an object.
- * @param {string} id the object identifier (either an Object ID or an Object Path)
- * @param {Array} tags a list of tags (metadata names) to delete from the object
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.deleteUserMetadata = function( id, tags, callback ) {
- var headers = {};
-
- this._addTagHeader( tags, headers );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this._getPath( id ) + '?metadata/user',
- method: 'DELETE',
- headers: headers,
- complete: callback
- } );
-};
-
-/**
- * Returns a list of the tags that are listable the current user's tennant.
- * @param {string} tag optional. If specified, the list will be limited to the tags
- * under the specified tag. If null, only top level tags will be returned.
- * @param {function} callback the completion callback (both error and success). The list of tags returned will be in
- * result.value
- */
-AtmosRest.prototype.getListableTags = function( tag, callback ) {
- var headers = {};
- var me = this;
-
- if ( tag ) this._addTagHeader( [tag], headers );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + "/objects?listabletags",
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- var decode = xhr.getResponseHeader( "x-emc-utf8" ) == "true";
- var tagHeader = xhr.getResponseHeader( "x-emc-listable-tags" );
- if ( tagHeader ) result.value = me._listToArray( tagHeader, decode );
- },
- complete: callback
- } )
-};
-
-/**
- * Lists objects from the server using a listable tag.
- * @param {string} tag the listable tag to search
- * @param {ListOptions} options for listing objects. See the ListOptions class.
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the result's value property will be populated with an Array of ObjectResult objects. Also
- * be sure to check the token property. If defined, you did not receive all results
- * and should call this method again using the token inside a ListOptions object to continue
- * your listing.
- */
-AtmosRest.prototype.listObjects = function( tag, options, callback ) {
- if ( !tag ) throw "Tag cannot be null";
- var headers = {};
- var me = this;
-
- this._addTagHeader( [tag], headers );
-
- this._addListOptionHeaders( headers, options );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + "/objects",
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processListObjectsResult( result, xhr );
- },
- complete: callback
- } )
-};
-
-/**
- * Lists objects from the server within a directory (path).
- * @param {string} directory the directory (path) in which to list objects (must exist!)
- * @param {ListOptions} options for listing objects. See the ListOptions class. NOTE: metadata can only be returned in
- * Atmos >1.3
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the result's value property will be populated with an Array of DirectoryItem objects. Also
- * be sure to check the token property. If defined, you did not receive all results
- * and should call this method again using the token inside a ListOptions object to continue
- * your listing.
- */
-AtmosRest.prototype.listDirectory = function( directory, options, callback ) {
- if ( !directory ) throw "Directory cannot be null";
- if ( directory.charAt( directory.length - 1 ) !== "/" ) {
- throw "Directory must end with a slash";
- }
- var headers = {};
- var me = this;
-
- this._addListOptionHeaders( headers, options );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + "/namespace" + directory,
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- me._processListDirectoryResult( directory, result, xhr );
- },
- complete: callback
- } );
-};
-
-/**
- * Creates an anonymous access token.
- * @param {AccessTokenPolicy} tokenPolicy the token policy for the new access token
- * @param {string=} id the object identifier (either an object path or an object id) targeted by the access token
- * @param {Acl=} acl the ACL that will be assigned to objects created using this access token
- * @param {Object=} meta a map of regular Metadata for uploads. May be null or empty for no regular metadata.
- * @param {Object=} listableMeta a map of listable Metadata for uploads. May be null or empty for no listable metadata.
- * @param {function=} callback the completion callback (both error and success). Upon success,
- * the result's value property will be populated with the access token's URL
- */
-AtmosRest.prototype.createAccessToken = function( tokenPolicy, id, acl, meta, listableMeta, callback ) {
- var headers = {};
- var me = this;
-
- if ( id ) {
- if ( AtmosRest.objectPathMatch.test( id ) )
- headers['x-emc-path'] = this.atmosConfig.enableUtf8 ? encodeURIComponent( id ) : id;
- else headers['x-emc-objectid'] = id;
- }
- this._addAclHeaders( acl, headers );
- this._addMetadataHeaders( meta, headers, false );
- this._addMetadataHeaders( listableMeta, headers, true );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + '/accesstokens',
- method: 'POST',
- headers: headers,
- data: AtmosUtil.serializeXml( tokenPolicy.toDocument() ),
- mimeType: 'application/xml',
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- result.value = me._resolveUrl( xhr.getResponseHeader( 'location' ) );
- },
- complete: callback
- } );
-};
-
-/**
- * Retrieves details about the specified access token
- * @param {string} tokenUri the URL, URI, path or id of the access token to retrieve
- * @param {function=} callback the completion callback (both error and success). Upon success,
- * the AccessToken object will be in result.value.
- */
-AtmosRest.prototype.getAccessToken = function( tokenUri, callback ) {
- if ( !tokenUri ) tokenUri = '';
- var elements = tokenUri.split( '/' );
- var tokenId = elements[elements.length - 1];
- var me = this;
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + '/accesstokens/' + tokenId + '?info',
- method: 'GET',
- headers: {},
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- result.value = AccessToken.fromNode( AtmosUtil.getChildByTagName( me._getXmlDoc( xhr ), 'access-token' ) );
- },
- complete: callback
- } );
-};
-
-/**
- * Deletes an access token
- * @param {string} tokenUri the URL, URI, path or id of the access token to delete
- * @param {function=} callback the completion callback (both error and success).
- */
-AtmosRest.prototype.deleteAccessToken = function( tokenUri, callback ) {
- var elements = tokenUri.split( '/' );
- var tokenId = elements[elements.length - 1];
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + '/accesstokens/' + tokenId,
- method: 'DELETE',
- headers: {},
- complete: callback
- } );
-};
-
-/**
- * Lists all access tokens created by the user.
- * @param {ListOptions} options for listing objects. See the ListOptions class. NOTE: metadata can only be returned in
- * Atmos >1.3
- * @param {function} callback the completion callback (both error and success). Upon success,
- * the result's value property will be populated with an Array of AccessToken objects. Also
- * be sure to check the token property. If defined, you did not receive all results
- * and should call this method again using the token inside a ListOptions object to continue
- * your listing.
- */
-AtmosRest.prototype.listAccessTokens = function( options, callback ) {
- var headers = {};
- var me = this;
-
- this._addListOptionHeaders( headers, options );
-
- this._ajax( /** @type HttpRequest */ {
- uri: this.context + "/accesstokens",
- method: 'GET',
- headers: headers,
- processResult: function( result, xhr ) {
- if ( !result.successful ) return;
- result.token = xhr.getResponseHeader( "x-emc-token" );
- var root = AtmosUtil.getChildByTagName( me._getXmlDoc( xhr ), 'list-access-tokens-result' );
- var listNode = AtmosUtil.getChildByTagName( root, 'access-tokens-list' );
- var tokenList = [];
- AtmosUtil.getChildrenByTagName( listNode, 'access-token' ).forEach( function( tokenNode ) {
- tokenList.push( AccessToken.fromNode( tokenNode ) );
- } );
- result.value = tokenList;
- },
- complete: callback
- } );
-};
-
-/////////////////////
-// Private Methods //
-/////////////////////
-
-AtmosRest.locationMatch = /^\/rest\/objects\/(.*)/;
-AtmosRest.objectPathMatch = /^\//;
-
-/**
- * Determines whether id is a path or objectid and constructs the proper
- * resource path.
- * @param {string} id
- * @return {string}
- */
-AtmosRest.prototype._getPath = function( id ) {
- if ( AtmosRest.objectPathMatch.test( id ) ) {
- return this.context + "/namespace" + id;
- } else {
- return this.context + "/objects/" + id;
- }
-};
-
-/**
- * Adds Acl entries to the headers of a request
- * @param {Acl} acl
- * @param {Object} headers
- */
-AtmosRest.prototype._addAclHeaders = function( acl, headers ) {
- if ( acl == null ) return;
-
- headers["x-emc-useracl"] = this._mapEntriesToString( acl.userEntries );
- headers["x-emc-groupacl"] = this._mapEntriesToString( acl.groupEntries );
-};
-
-/**
- * Serialize a list of map entries into a parameter string (entry1.key=entry1.value,entry2.key=entry2.value)
- */
-AtmosRest.prototype._mapEntriesToString = function( entries ) {
- if ( entries == undefined || entries.length < 1 ) return null;
-
- var params = [];
- for ( var i = 0; i < entries.length; i++ ) {
- params.push( entries[i].key + "=" + entries[i].value );
- }
- return params.join( "," );
-};
-
-/**
- * Compiles a list of tags into a header value (comma-separated0
- */
-AtmosRest.prototype._addTagHeader = function( tags, headers ) {
- var value = "";
- for ( var i = 0; i < tags.length; i++ ) {
- if ( i > 0 ) value += ",";
- value += this.atmosConfig.enableUtf8 ? encodeURIComponent( tags[i] ) : tags[i];
- }
- headers["x-emc-tags"] = value;
-};
-
-/**
- * Compiles a list of metadata into a header value
- */
-AtmosRest.prototype._addMetadataHeaders = function( meta, headers, listable ) {
- if ( meta == null || Object.keys( meta ).length == 0 ) {
- return;
- }
- if ( listable ) {
- headers["x-emc-listable-meta"] = this._metaToHeaderValue( meta );
- } else {
- headers["x-emc-meta"] = this._metaToHeaderValue( meta );
- }
-};
-
-/**
- * Serialize a metadata object into a header value (map.key1=map.value1,map.key2=map.value2)
- */
-AtmosRest.prototype._metaToHeaderValue = function( meta ) {
- var params = [], keys = Object.keys( meta );
- for ( var i = 0; i < keys.length; i++ ) {
- var key = this.atmosConfig.enableUtf8 ? encodeURIComponent( keys[i] ) : keys[i];
- var value = this.atmosConfig.enableUtf8 ? encodeURIComponent( meta[keys[i]] ) : meta[keys[i]];
- params.push( key + "=" + value );
- }
- return params.join( "," );
-};
-
-/**
- * Converts a comma-separated list of values into an array of those values.
- */
-AtmosRest.prototype._listToArray = function( listString, decode ) {
- if ( !listString ) return null;
- if ( listString.trim().length == 0 ) return [];
- var array = listString.split( "," );
- for ( var i = 0; i < array.length; i++ ) {
- array[i] = decode ? decodeURIComponent( array[i].trim() ) : array[i].trim();
- }
- return array;
-};
-
-/**
- * Adds headers for the list options
- * @param headers {Array} the existing headers map
- * @param options {ListOptions} the desired list options
- */
-AtmosRest.prototype._addListOptionHeaders = function( headers, options ) {
- if ( options ) {
- if ( options.limit ) {
- headers["x-emc-limit"] = "" + options.limit;
- }
- if ( options.token ) {
- headers["x-emc-token"] = options.token;
- }
- if ( options.includeMeta ) {
- headers["x-emc-include-meta"] = "1";
- if ( options.userMetaTags ) {
- headers["x-emc-user-tags"] = options.userMetaTags.join( "," );
- }
- if ( options.systemMetaTags ) {
- headers["x-emc-system-tags"] = options.systemMetaTags.join( "," );
- }
- }
- }
-};
-
-AtmosRest.prototype._prepBaseHeaders = function( headers, range ) {
- headers["x-emc-date"] = new Date().toGMTString();
- if ( range ) headers["Range"] = range.toString();
-};
-
-AtmosRest.prototype._prepUploadHeaders = function( headers, mimeType ) {
- if ( mimeType == "" || mimeType == undefined ) {
- mimeType = "text/plain; charset=UTF-8";
- }
-
- // The browser will append this on the way out. Do it ourselves
- // so it gets into our signature.
- if ( mimeType.indexOf( "charset" ) == -1 ) {
- mimeType += "; charset=UTF-8";
- }
-
- headers["Content-Type"] = mimeType;
-};
-
-/**
- * Abstracts an ajax call
- * @param {HttpRequest} request abstracted HTTP request
- */
-AtmosRest.prototype._ajax = function( request ) {
- request.uri = this._resolveDots( request.uri );
-
- if ( request.headers ) {
- if ( this.atmosConfig.enableUtf8 ) {
- request.headers["x-emc-utf8"] = "true";
- }
-
- this._prepBaseHeaders( request.headers, request.range );
- if ( /(POST|PUT)/.test( request.method ) ) this._prepUploadHeaders( request.headers, request.mimeType );
-
- this._signRequest( request.method, request.headers, request.uri );
- }
-
- // skip for absolute URLs
- if ( !/^https?:\/\//.test( request.uri ) ) {
-
- // encode *after* signing
- request.uri = this._encodeURI( request.uri );
-
- // If a cross-domain request...
- if ( this.atmosConfig.host && this.atmosConfig.protocol ) {
- var baseUri = this.atmosConfig.protocol + "//" + this.atmosConfig.host;
- if ( this.atmosConfig.port ) baseUri += ':' + this.atmosConfig.port;
- request.uri = baseUri + request.uri;
- }
- }
-
- // success/error handling
- var me = this;
- var responseHandler = function( xhr ) {
- var result = me._createResult( xhr, xhr.status < 400 );
- if ( request.processResult ) request.processResult( result, xhr );
- if ( request.complete ) request.complete( result );
- };
-
- if ( request.form ) { // using form
-
- // make sure headers are returned in the response text (we cannot access response headers in an iframe)
- request.headers['x-http-inject-response-headers'] = 'true';
-
- // we can only POST a form
- if ( request.method != 'POST' ) request.headers['x-http-method-override'] = request.method;
-
- var iframe = this._createTargetIframe( function( responseText ) {
- var xhrFacade = me._parseFormResponse( responseText );
- responseHandler( xhrFacade );
- } );
-
- this._setFormHeaders( request.form, request.headers );
-
- // progress is unsupported
- if ( request.progress ) request.progress( -1 );
-
- request.form.action = request.uri;
- request.form.method = 'POST';
- request.form.enctype = request.form.encoding = 'multipart/form-data';
- request.form.target = iframe.name;
- request.form.submit();
-
- // make sure we clean up our added fields, or they will be included in future POSTs
- this._unsetFormHeaders( request.form, request.headers );
-
- } else { // using XHR
-
- var xhr = this._getXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if ( xhr.readyState == 4 ) {
- responseHandler( xhr );
- }
- };
-
- // progress callback
- try {
- if ( request.progress ) {
- (xhr.upload || xhr).onprogress = function( event ) {
- if ( event.lengthComputable ) {
- var progressPercent = Math.floor( (event.position || event.loaded) / (event.totalSize || event.total) * 100 );
- request.progress( progressPercent );
- }
- };
- }
- } catch ( e ) {
- // progress isn't supported
- request.progress( -1 );
- }
-
- xhr.open( request.method, request.uri, true );
-
- this._setHeaders( xhr, request.headers );
-
- if ( request.data ) xhr.send( request.data );
- else xhr.send();
-
- }
-};
-
-AtmosRest.prototype._getXMLHttpRequest = function() {
- if ( isNodejs ) {
- return new XMLHttpRequest();
- }
-
- if ( window.XMLHttpRequest ) {
- return new window.XMLHttpRequest;
- }
- else {
- try {
- return new ActiveXObject( "MSXML2.XMLHTTP.3.0" );
- }
- catch ( ex ) {
- return null;
- }
- }
-};
-
-AtmosRest.prototype._setFormHeaders = function( form, headers ) {
-
- // headers get passed as form parameters
- var keys = Object.keys( headers );
- for ( var i = 0; i < keys.length; i++ ) {
- var element = form.elements[keys[i]];
- if ( !element ) {
- try { // for IE6
- element = document.createElement( '' );
- } catch ( e ) {
- element = document.createElement( 'input' );
- element.name = keys[i];
- }
- element.type = "hidden";
- form.insertBefore( element, form.childNodes[0] );
- }
- element.value = headers[keys[i]];
- }
-};
-
-AtmosRest.prototype._unsetFormHeaders = function( form, headers ) {
-
- // remove headers form form parameters to avoid re-POSTing them
- var keys = Object.keys( headers );
- for ( var i = 0; i < keys.length; i++ ) {
- var element = form.elements[keys[i]];
- if ( element ) {
- form.removeChild( element );
- }
- }
-};
-
-AtmosRest.prototype._createTargetIframe = function( callback ) {
- var name = 'ATMOS_IFRAME_' + ++AtmosRest.iframeCount;
- var iframe;
- try { // for IE6
- iframe = document.createElement( '' );
- } catch ( e ) {
- iframe = document.createElement( 'iframe' );
- iframe.name = name;
- }
- iframe.id = name;
- iframe.style.display = 'none';
- document.body.appendChild( iframe );
- var complete = function() {
- var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
- var content = iframeDoc.body != null ? iframeDoc.body.firstChild.innerHTML : iframeDoc.documentElement.innerHTML;
- callback.call( iframe, content );
- document.body.removeChild( iframe );
- };
- if ( iframe.attachEvent ) iframe.attachEvent( "onload", complete );
- else iframe.onload = complete;
- return iframe;
-};
-
-AtmosRest.prototype._parseFormResponse = function( responseText ) {
- this.debug( 'form response (raw):\n' + responseText );
-
- var xhrFacade = {};
- xhrFacade.headers = {};
-
- // parse headers
- var headerLength;
- try {
- var charCount = 0;
- var nextLine = function( purge ) {
- var breakIndex = responseText.indexOf( '\n' );
- if ( breakIndex < 0 ) breakIndex = responseText.length;
- var line = responseText.substr( 0, breakIndex );
- if ( purge ) {
- responseText = responseText.substr( breakIndex + 1 ); // exclude endline char
- charCount += breakIndex + 1;
- }
- if ( line.charAt( line.length - 1 ) == '\r' ) line = line.substr( 0, line.length - 1 ); // remove CR when in Windows
- return line;
- };
-
- // get header length
- headerLength = parseInt( nextLine( false ) );
- if ( !isNaN( headerLength ) ) {
- nextLine( true );
-
- var statusLine = nextLine( true );
- var statusWords = statusLine.split( ' ' );
- xhrFacade.status = parseInt( statusWords[1] );
- xhrFacade.statusText = statusLine.substr( statusWords[0].length + statusWords[1].length + 2 );
-
- while ( charCount < headerLength ) {
- var line = nextLine( true );
- var separatorIndex = line.indexOf( ': ' );
- xhrFacade.headers[line.substr( 0, separatorIndex )] = line.substr( separatorIndex + 2 );
- }
- }
- } catch ( error ) {
- this.warn( 'could not parse headers in form response: ' + error );
- }
-
- xhrFacade.getResponseHeader = function( name ) {
- return this.headers[name];
- };
- xhrFacade.responseText = this._decodeXmlEntities( responseText );
-
- return xhrFacade;
-};
-
-/**
- * Decodes XML entities ('>' => '<')
- * @param raw raw text to decode
- */
-AtmosRest.prototype._decodeXmlEntities = function( raw ) {
- raw = raw.replace( />/g, '>' );
- raw = raw.replace( /</g, '<' );
- return raw;
-};
-
-/**
- * Resolves dot references in a path (parent/child/../ => parent/)
- * @param path the path to resolve
- */
-AtmosRest.prototype._resolveDots = function( path ) {
- if ( !path ) return path;
- var segments = path.split( "/" );
- for ( var i = 0; i < segments.length; i++ ) {
- if ( segments[i] == ".." ) {
- segments.splice( i - 1, 2 ); // remove this segment and the last
- i -= 2; // two items were removed, so make sure the index rewinds by two
- } else if ( segments[i] == "." ) {
- segments.splice( i--, 1 ); // remove only this segment and rewind the index by one
- }
- }
- return segments.join( "/" );
-};
-
-/**
- * Sets the headers on the XMLHttpRequest
- * @param {XMLHttpRequest} xhr the XMLHttpRequest
- * @param {Object} headers the property hash containing the header values to set
- */
-AtmosRest.prototype._setHeaders = function( xhr, headers ) {
- if ( !headers ) return;
- for ( var prop in headers ) {
- if ( !headers.hasOwnProperty( prop ) ) continue;
- xhr.setRequestHeader( prop, headers[prop] );
- }
-};
-
-/**
- * Encodes the individual path components of a URI.
- * @param uri
- * @returns {string} the URI with the path components encoded.
- */
-AtmosRest.prototype._encodeURI = function( uri ) {
- this.debug( "encodeURI: in: " + uri );
- var queryIndex = uri.indexOf( "?" );
- var query = "";
- if ( queryIndex != -1 ) {
- query = uri.substring( queryIndex );
- uri = uri.substring( 0, queryIndex );
- }
- var parts = uri.split( "/" );
- var outURI;
- for ( var i = 0; i < parts.length; i++ ) {
- parts[i] = encodeURIComponent( parts[i] );
- }
- outURI = parts.join( "/" );
-
- if ( queryIndex != -1 ) {
- outURI += encodeURI( query );
- }
-
- this.debug( "encodeURI: out: " + outURI );
-
- return outURI;
-};
-
-/**
- * @param xhr {XMLHttpRequest}
- * @param success {boolean}
- * @return {AtmosResult}
- * @private
- */
-AtmosRest.prototype._createResult = function( xhr, success ) {
- var result = new AtmosResult( success );
-
- result.httpCode = xhr.status;
- result.httpMessage = xhr.statusText;
-
- if ( !success ) {
- var doc = this._getXmlDoc( xhr );
- var errorNodes = doc.getElementsByTagName( "Error" );
- if ( errorNodes.length ) {
- result.errorCode = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( errorNodes[0], "Code" ) );
- result.errorMessage = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( errorNodes[0], "Message" ) );
- }
- }
-
- return result;
-};
-
-AtmosRest.prototype._getXmlDoc = function( xhr ) {
- if ( xhr.responseXML ) {
- return xhr.responseXML;
- } else {
- this.debug( "response:\n" + xhr.responseText );
- return AtmosUtil.parseXml( xhr.responseText );
- }
-};
-
-/**
- * Processes the create object response and extracts the new object ID
- * @param {AtmosResult} result result object passed from _ajax callback
- * @param {XMLHttpRequest} xhr the XHR object containing the response
- */
-AtmosRest.prototype._processCreateObjectResult = function( result, xhr ) {
- // Extract the new ObjectId and return
- var location = xhr.getResponseHeader( 'location' );
-
- this.debug( "location: " + location );
-
- var matches = location.match( AtmosRest.locationMatch );
- if ( !matches ) {
- result.successful = false;
- result.message = "Could not find location in " + location;
- } else {
- result.value = matches[1];
- this.debug( "Location: " + result.value );
- }
-};
-
-/**
- * Parses a metadata value string into a property object
- * @param {string} value the metadata value string
- * @param {boolean} decode whether to URI decode the name/value pairs (if UTF8 header is set)
- * @returns {Object} a property object containing the values
- */
-AtmosRest.prototype._parseMetadata = function( value, decode ) {
- if ( typeof(value) == 'undefined' || value == null || value.length == 0 ) {
- return null;
- }
-
- var result = {};
-
- var values = value.split( "," );
- for ( var i = 0; i < values.length; i++ ) {
- var nvpair = values[i].split( "=", 2 );
- var name = decode ? decodeURIComponent( nvpair[0].trim() ) : nvpair[0].trim();
- if ( nvpair.length == 1 ) {
- result[name] = "";
- } else {
- result[name] = decode ? decodeURIComponent( nvpair[1] ) : nvpair[1];
- }
- }
-
- return result;
-};
-
-/**
- * Handles the response from the ListObjects method
- * @param {AtmosResult} result
- * @param {XMLHttpRequest} xhr the XHR object
- */
-AtmosRest.prototype._processListObjectsResult = function( result, xhr ) {
- result.token = xhr.getResponseHeader( "x-emc-token" );
-
- var doc = this._getXmlDoc( xhr );
-
- var objects = [];
-
- /**
- * @type NodeList
- */
- var objlist = doc.getElementsByTagName( "Object" );
-
- for ( var i = 0; i < objlist.length; i++ ) {
- var userMeta = null;
- var systemMeta = null;
- var userListableMeta = null;
-
- var node = objlist.item( i );
- var oidNode = AtmosUtil.getChildByTagName( node, "ObjectID" );
- var smNode = AtmosUtil.getChildByTagName( node, "SystemMetadataList" );
- var umNode = AtmosUtil.getChildByTagName( node, "UserMetadataList" );
-
- if ( smNode ) {
- systemMeta = {};
- this._parseResponseMeta( smNode.childNodes, systemMeta, null );
- }
- if ( umNode ) {
- userMeta = {};
- userListableMeta = {};
- this._parseResponseMeta( umNode.childNodes, userMeta, userListableMeta );
- }
-
- var obj = new ObjectResult( AtmosUtil.getTextContent( oidNode ), userMeta, userListableMeta, systemMeta );
- objects.push( obj );
- }
-
- result.value = objects;
-};
-
-/**
- * Handles the response from the ListDirectory method
- * @param {string} directoryPath
- * @param {AtmosResult} result
- * @param {XMLHttpRequest} xhr the XHR object
- */
-AtmosRest.prototype._processListDirectoryResult = function( directoryPath, result, xhr ) {
- result.token = xhr.getResponseHeader( "x-emc-token" );
-
- var doc = this._getXmlDoc( xhr );
-
- var entries = [];
-
- /**
- * @type NodeList
- */
- var dirlist = doc.getElementsByTagName( "DirectoryEntry" );
-
- for ( var i = 0; i < dirlist.length; i++ ) {
- var userMeta = null;
- var systemMeta = null;
- var userListableMeta = null;
-
- var node = dirlist.item( i );
- var oidNode = AtmosUtil.getChildByTagName( node, "ObjectID" );
- var pathName = AtmosUtil.getChildByTagName( node, "Filename" );
- var type = AtmosUtil.getChildByTagName( node, "FileType" );
- var smNode = AtmosUtil.getChildByTagName( node, "SystemMetadataList" );
- var umNode = AtmosUtil.getChildByTagName( node, "UserMetadataList" );
-
- if ( smNode ) {
- systemMeta = {};
- this._parseResponseMeta( smNode.childNodes, systemMeta, null );
- }
- if ( umNode ) {
- userMeta = {};
- userListableMeta = {};
- this._parseResponseMeta( umNode.childNodes, userMeta, userListableMeta );
- }
-
- var entry = new DirectoryItem( directoryPath + AtmosUtil.getTextContent( pathName ),
- AtmosUtil.getTextContent( pathName ), AtmosUtil.getTextContent( type ),
- AtmosUtil.getTextContent( oidNode ), userMeta, userListableMeta, systemMeta );
- entries.push( entry );
- }
-
- result.value = entries;
-};
-
-/**
- * Handles the response from the GetObjectInfo method
- */
-AtmosRest.prototype._processObjectInfoResult = function( result, xhr ) {
- var doc = this._getXmlDoc( xhr );
- var objectId = null, selection = null, replicas = [];
- var expirationEnabled = false, expirationEndsAt = null, retentionEnabled = false, retentionEndsAt = null;
-
- var nodes = doc.getElementsByTagName( "objectId" );
- if ( nodes.length ) objectId = AtmosUtil.getTextContent( nodes.item( 0 ) );
-
- nodes = doc.getElementsByTagName( "selection" );
- if ( nodes.length ) selection = AtmosUtil.getTextContent( nodes.item( 0 ) );
-
- nodes = doc.getElementsByTagName( "replicas" );
- if ( nodes.length ) {
- nodes = AtmosUtil.getChildrenByTagName( nodes.item( 0 ), 'replica' );
- for ( var i = 0; i < nodes.length; i++ ) {
- var node = nodes[i];
- var id = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'id' ) );
- var location = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'location' ) );
- var replicaType = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'type' ) );
- var current = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'current' ) );
- var storageType = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'storageType' ) );
- replicas.push( new ObjectReplica( id, location, replicaType, current, storageType ) );
- }
- }
-
- nodes = doc.getElementsByTagName( "expiration" );
- if ( nodes.length ) {
- node = nodes.item( 0 );
- expirationEnabled = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'enabled' ) );
- expirationEndsAt = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'endAt' ) );
- }
-
- nodes = doc.getElementsByTagName( "retention" );
- if ( nodes.length ) {
- node = nodes.item( 0 );
- retentionEnabled = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'enabled' ) );
- retentionEndsAt = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( node, 'endAt' ) );
- }
-
- result.value = new ObjectInfo( objectId, selection, replicas, expirationEnabled, expirationEndsAt, retentionEnabled, retentionEndsAt );
-};
-
-/**
- * Parses the object versions list from a listVersions request
- * @param xhr {XMLHttpRequest} xhr the XHR object
- * @return {Array.} the list of object versions represented by the XML
- */
-AtmosRest.prototype._parseObjectVersions = function( xhr ) {
- var versions = [];
-
- var doc = this._getXmlDoc( xhr );
-
- var verNodes = doc.getElementsByTagName( "Ver" );
- for ( var i = 0; i < verNodes.length; i++ ) {
- versions.push( /** ObjectVersion */ {
- num: AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( verNodes.item( i ), "VerNum" ) ),
- oid: AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( verNodes.item( i ), "OID" ) ),
- dateCreated: AtmosUtil.parseIso8601Date( AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( verNodes.item( i ), "itime" ) ) )
- } );
- }
-
- return versions;
-};
-
-/**
- * Parses ACL entries from a response header list from a get ACL request
- * @param {string} header the response header from a get ACL request
- */
-AtmosRest.prototype._parseAclEntries = function( header ) {
- var aclEntries = [];
- var grants = this._listToArray( header );
- for ( var i = 0; i < grants.length; i++ ) {
- var nvpair = grants[i].split( "=", 2 );
- var grantee = nvpair[0];
- var permission = nvpair[1];
-
- grantee = grantee.trim();
-
- // Currently, the server returns "FULL" instead of "FULL_CONTROL".
- // For consistency, change this to value use in the request
- if ( "FULL" === permission ) {
- permission = AclEntry.ACL_PERMISSIONS.FULL_CONTROL;
- }
-
- aclEntries[i] = new AclEntry( grantee, permission );
- }
- return aclEntries;
-};
-
-/**
- * Parses object metadata for an object listing result
- * @param {NodeList} nodeList the node list containing Metadata
- * @param {Object} regMeta property object to populate with regular metadata
- * @param {Object} listableMeta property object to populate with listable metadata
- */
-AtmosRest.prototype._parseResponseMeta = function( nodeList, regMeta, listableMeta ) {
- for ( var i = 0; i < nodeList.length; i++ ) {
- var child = nodeList.item( i );
- if ( !/Metadata/i.test( child.nodeName ) ) {
- continue;
- }
- var metaName = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( child, "Name" ) );
- var metaValue = AtmosUtil.getTextContent( AtmosUtil.getChildByTagName( child, "Value" ) );
- var listableNode = AtmosUtil.getChildByTagName( child, "Listable" );
- if ( listableNode ) {
- if ( AtmosUtil.getTextContent( listableNode ) == "true" ) {
- listableMeta[metaName] = metaValue;
- continue;
- }
- }
- regMeta[metaName] = metaValue;
- }
-};
-
-/**
- * Signs the REST request
- * @param {string} method the HTTP method (GET, PUT, DELETE, POST, HEAD)
- * @param {Object} headers the object containing the HTTP headers as properties
- * !!IMPORTANT!! this method assumes Content-Type and Range are already set!
- * @param {string} uri the path to the request
- */
-AtmosRest.prototype._signRequest = function( method, headers, uri ) {
- this.debug( this.atmosConfig.uid );
- this.debug( this.atmosConfig.secret );
-
- headers["x-emc-uid"] = this.atmosConfig.uid;
-
- var hash_string = this._buildHashString( method, uri, headers );
- this.debug( "HashString:\n" + hash_string );
-
- var signature = this._doSignature( hash_string, this.atmosConfig.secret );
- this.debug( "Signature: " + signature );
-
- headers["x-emc-signature"] = signature;
-
- return signature;
-};
-
-/**
- * Generates the string to sign
- * @param {string} method the HTTP method
- * @param {string} path the request uri
- * @param {Object} headers the object containing the HTTP headers as properties
- * @returns {string} the string to sign
- */
-AtmosRest.prototype._buildHashString = function( method, path, headers ) {
- var content_type = headers["Content-Type"];
- var range = headers["Range"];
- var date = headers["Date"];
-
- var emcheaders = {};
- var string = "";
- string = method + "\n";
-
- if ( content_type ) {
- string += content_type + "\n";
- } else {
- string += "\n";
- }
- if ( range ) {
- string += range.toString() + "\n";
- } else {
- string += "\n";
- }
- if ( date ) {
- string += date + '\n';
- } else {
- string += "\n";
- }
-
- string += path.toLowerCase().trim() + "\n";
-
- for ( var prop in headers ) {
- if ( !headers.hasOwnProperty( prop ) ) continue;
- this.debug( "headers: prop: " + prop + " value: " + headers[prop] );
-
-
- var key = this._normalizeWS( prop.toLowerCase().trim() );
- if ( key.indexOf( "x-emc" ) != 0 ) {
- this.debug( "Skipping " + key );
- continue;
- }
-
- var value = headers[prop];
- if ( value ) value = this._normalizeWS( value.trim() );
- emcheaders[key] = value;
- }
-
- var keys = Object.keys( emcheaders );
- this.debug( "keys " + keys );
-
- keys.sort().forEach( function( k ) {
- string += k + ":" + emcheaders[k] + "\n";
- } );
-
- return string.trim();
-};
-
-/**
- * Normalizes the whitespace in an object (condenses multiple spaces into one space)
- * @param {string} str the string to process
- * @returns {string} the output string
- */
-AtmosRest.prototype._normalizeWS = function( str ) {
- if ( str == null ) return null;
- str = str.replace( /\n/, " " );
- return str.replace( /\s+/, " " );
-};
-
-/**
- * Signs a string using HMAC-SHA1
- * @param {string} string the string content to sign
- * @param {string} secret the secret key, base-64 encoded.
- * @returns {string} the signature, base-64 encoded.
- */
-AtmosRest.prototype._doSignature = function( string, secret ) {
- this.debug( "Secret: " + secret );
-
- if ( isNodejs ) {
- var key = new Buffer( secret, 'base64' );
- var hmac = crypto.createHmac( "sha1", key.toString( 'binary' ) );
- hmac.update( string, 'utf8' );
- return hmac.digest( 'base64' );
- } else {
- var sig = Crypto.HMAC( Crypto.SHA1, string, Crypto.util.base64ToBytes( secret ), {asBytes: true} );
- return Crypto.util.bytesToBase64( sig );
- }
-};
-
-/**
- * resolves a path and querystring to a fully qualified URL if a protocol and host can be inferred. looks in atmosConfig
- * first and then window.location for a protocol, host and port to use.
- * @param {string} path the absolute path of the URL
- * @param {string=} query the querystring (without the question mark) of the URL
- * @return {string} a fully qualified URL including protocol (scheme), host and port.
- */
-AtmosRest.prototype._resolveUrl = function( path, query ) {
- var url = "";
- if ( this.atmosConfig.protocol && this.atmosConfig.host ) {
- url = this.atmosConfig.protocol + "//" + this.atmosConfig.host;
- if ( this.atmosConfig.port ) url += ":" + this.atmosConfig.port;
- } else if ( typeof(window) != 'undefined' ) {
- url = window.location.protocol + "//" + window.location.host;
- if ( window.location.port > 0 ) url += ":" + window.location.port;
- }
-
- url += path;
- if ( query ) url += "?" + query;
- return url;
-};
-
-//
-// Logging functions: see if the console is available and log to it.
-//
-
-/**
- * Outputs to the Console object (if it exists) as debug text
- * @param {string} message the string to write to the console.
- */
-AtmosRest.prototype.debug = function( message ) {
- if ( !this.atmosConfig.enableDebug ) return;
- if ( typeof(console) !== 'undefined' ) {
- if ( typeof(console.debug) !== 'undefined' ) {
- console.debug( message );
- } else if ( typeof(console.log) !== 'undefined' ) {
- console.log( message );
- }
- }
-};
-
-/**
- * Outputs to the Console object (if it exists) as info text
- * @param {string} message the string to write to the console.
- */
-AtmosRest.prototype.info = function( message ) {
- if ( typeof(console) !== 'undefined' && typeof(console.info) !== 'undefined' ) {
- console.info( message );
- }
-};
-
-/**
- * Outputs to the Console object (if it exists) as warning text
- * @param {string} message the string to write to the console.
- */
-AtmosRest.prototype.warn = function( message ) {
- if ( typeof(console) !== 'undefined' && typeof(console.warn) !== 'undefined' ) {
- console.warn( message );
- }
-};
-
-/**
- * Outputs to the Console object (if it exists) as error text
- * @param {string} message the string to write to the console.
- */
-AtmosRest.prototype.error = function( message ) {
- if ( typeof(console) !== 'undefined' && typeof(console.error) !== 'undefined' ) {
- console.error( message );
- }
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AtmosRest = AtmosRest;
-}
diff --git a/AtmosJS/src/AtmosResult.js b/AtmosJS/src/AtmosResult.js
deleted file mode 100644
index fc5632c..0000000
--- a/AtmosJS/src/AtmosResult.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * The AtmosResult object is returned to all of the
- * asynchronous callbacks. See individual functions
- * to determine the contents of the value object.
- * @param successful {boolean}
- * @param value {*=}
- * @param message {string=}
- * @param token {string=}
- * @constructor
- */
-AtmosResult = function( successful, value, message, token ) {
- this.successful = successful;
- this.value = value;
- this.message = message;
- this.token = token;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AtmosResult = AtmosResult;
-}
diff --git a/AtmosJS/src/AtmosServiceInfo.js b/AtmosJS/src/AtmosServiceInfo.js
deleted file mode 100644
index ef88213..0000000
--- a/AtmosJS/src/AtmosServiceInfo.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * @constructor
- * @param {string} version the version of Atmos
- * @param {boolean} object whether this Atmos instance supports the object REST API
- * @param {boolean} namespace whether this Atmos instance supports the namespace REST API
- * @param {boolean} utf8 whether this Atmos instance supports non-latin UTF8 content in headers
- * @param {boolean} browsercompat whether this Atmos instance supports additional browser compatibility features
- * (i.e. multipart form posts, response header inclusion, cache and content-disposition headers, etc.)
- * @param {boolean} keyvalue whether this Atmos instance supports key-value identifiers
- * @param {boolean} versioning whether this Atmos instance support object versioning
- */
-AtmosServiceInfo = function( version, object, namespace, utf8, browsercompat, keyvalue, versioning ) {
- this.version = version;
- this.object = object;
- this.namespace = namespace;
- this.utf8 = utf8;
- this.browsercompat = browsercompat;
- this.keyvalue = keyvalue;
- this.versioning = versioning;
-};
-
-/**
- * parses the feature properties of this object from header values to localize code
- * @param {string} featuresHeader the value of the x-emc-features header to be parsed into an AtmosServiceInfo object
- * @param {string} utf8Header the value of the x-emc-support-utf8 header (legacy)
- */
-AtmosServiceInfo.prototype.loadFeaturesFromHeader = function( featuresHeader, utf8Header ) {
- if ( featuresHeader ) {
- var tokens = featuresHeader.split( ", " );
- for ( var i = 0; i < tokens.length; i++ ) {
- tokens[i] = tokens[i].replace( /-/g, "" ); // remove hyphens
- this[tokens[i]] = true; // serviceInfo[feature] = true
- }
- } else {
- this.object = true;
- this.namespace = true;
- this.utf8 = utf8Header == "true";
- }
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AtmosServiceInfo = AtmosServiceInfo;
-}
diff --git a/AtmosJS/src/AtmosUtil.js b/AtmosJS/src/AtmosUtil.js
deleted file mode 100644
index 26ad656..0000000
--- a/AtmosJS/src/AtmosUtil.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-isNodeJs = false;
-if ( typeof(require) == 'function' ) {
- isNodeJs = true;
- var dom = require( 'xmldom' );
- DOMParser = dom.DOMParser;
- XMLSerializer = dom.XMLSerializer;
-}
-
-/**
- * Utility methods for Atmos JS SDK
- */
-AtmosUtil = {};
-
-/**
- * @return {Document}
- */
-AtmosUtil.createDocument = function() {
- if ( isNodeJs ) return new dom.DOMImplementation().createDocument( "", "", null );
- else if ( document.implementation.createDocument ) return document.implementation.createDocument( "", "", null );
- else if ( typeof ActiveXObject != 'undefined' ) return /** @type {Document} */ new ActiveXObject( "MSXML.DomDocument" );
- else return null;
-};
-
-/**
- * @param {Document} doc parent document in which to create an element
- * @param {string} name name of the element to create (tag name)
- * @param {string=} text optional text content for the new element
- * @param {Object=} attributes optional attributes of the new element
- * @return {Element}
- */
-AtmosUtil.createElement = function( doc, name, text, attributes ) {
- var element = doc.createElement( name );
- if ( text ) element.appendChild( doc.createTextNode( text ) );
- if ( attributes ) {
- for ( var key in attributes ) {
- if ( !attributes.hasOwnProperty( key ) ) continue;
- element.setAttribute( key, attributes[key] );
- }
- }
- return element;
-};
-
-/**
- * Parses an XML string into a Document object
- * @param {string} xmlString the XML string to parse
- * @return {Document} a document object representing the specified XML string
- */
-AtmosUtil.parseXml = function( xmlString ) {
- if ( isNodeJs ) {
- return new DOMParser().parseFromString( xmlString );
- } else if ( window.DOMParser ) {
- var parser = new DOMParser();
- return parser.parseFromString( xmlString, "text/xml" );
- } else if ( typeof ActiveXObject != 'undefined' ) {
- var doc = /** @type {Document} */ new ActiveXObject( "MSXML.DomDocument" );
- doc.async = false;
- doc.loadXML( xmlString );
- return doc;
- }
- return null;
-};
-
-/**
- * Generates an XML string from the specified Document object
- * @param {Document} doc an XML node
- * @return {string} XML string representing the specified document
- */
-AtmosUtil.serializeXml = function( doc ) {
- if ( isNodeJs ) {
- return new XMLSerializer().serializeToString( doc );
- } else if ( window.XMLSerializer ) {
- return new XMLSerializer().serializeToString( doc );
- } else if ( doc.xml ) {
- return doc.xml;
- }
- return null;
-}
-
-/**
- * Searches a node for a first-level child with the given tag name. If
- * not found, null will be returned.
- * @param {Node} node the node to search
- * @param {string} tagName the tag name to look for
- * @return {Node} the found node or null if not found.
- */
-AtmosUtil.getChildByTagName = function( node, tagName ) {
- var children = AtmosUtil.getChildrenByTagName( node, tagName );
- if ( children.length ) return children[0];
- return null;
-};
-
-/**
- * Searches a node for all first-level children with the given tag name. If
- * not found, an empty array will be returned.
- * @param {Node} node the node to search
- * @param {string} tagName the tag name to look for
- * @return {Array.} the found child nodes or an empty array if not found.
- */
-AtmosUtil.getChildrenByTagName = function( node, tagName ) {
- var reg = new RegExp( '^' + tagName + '$', "i" ); // jsnode uses HTML uppercase names, so do insensitive
- var children = node.childNodes;
- var nodes = [];
- for ( var i = 0; i < children.length; i++ ) {
- var child = children.item( i );
- if ( child.nodeType != 1 ) {
- continue; // not an element
- }
- if ( reg.test( child.nodeName ) ) {
- nodes.push( child );
- }
- }
- return nodes;
-};
-
-/**
- * Gets the text from a node
- * @param {Node} node the node to collect text from
- * @return {string} the node's child text
- */
-AtmosUtil.getTextContent = function( node ) {
- var children = node.childNodes;
- var text = "";
- for ( var i = 0; i < children.length; i++ ) {
- var child = children.item( i );
- if ( child.nodeType == 3 ) { // Text node
- text += child.data;
- }
- }
-
- return text;
-};
-
-/**
- * Parses an ISO-8601 date (with or without a timezone offset, i.e. '-0600').
- * @param text
- * @return {Date}
- */
-AtmosUtil.parseIso8601Date = function( text ) {
- var iso8601RE = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]{3})?(?:([+-][0-9]{2})([0-9]{2})|Z)$/;
- var match = iso8601RE.exec( text ), date;
- if ( match ) {
- var year = parseInt( match[1] ), month = parseInt( match[2] ) - 1, day = parseInt( match[3] );
- var hour = parseInt( match[4] ), min = parseInt( match[5] ), sec = parseInt( match[6] );
- var hourOffset = 0, minuteOffset = 0;
- if ( match[7] ) {
- hourOffset = -parseInt( match[7] );
- minuteOffset = parseInt( match[8] );
- }
- date = new Date();
- date.setUTCFullYear( year, month, day );
- date.setUTCHours( hour + hourOffset, min + minuteOffset, sec, 0 );
- } else {
- date = new Date( text );
- date.setMilliseconds( 0 );
- }
- return date;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.AtmosUtil = AtmosUtil;
-}
diff --git a/AtmosJS/src/DirectoryItem.js b/AtmosJS/src/DirectoryItem.js
deleted file mode 100644
index 6912142..0000000
--- a/AtmosJS/src/DirectoryItem.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * @param {string} path the full path of the object
- * @param {string} name the name of the object (excluding path info)
- * @param {string} type the type of object ("directory" or "regular")
- * @param {string} objectId the object's identifier
- * @param {Object} userMeta an object containing the user metadata properties
- * @param {Object} listableUserMeta an object containing the listable user metadata properties
- * @param {Object} systemMeta an object containing the system metadata properties
- * @constructor
- */
-DirectoryItem = function( path, name, type, objectId, userMeta, listableUserMeta, systemMeta ) {
- this.id = path;
- this.path = path;
- this.name = name;
- this.type = type;
- this.objectId = objectId;
- this.userMeta = userMeta;
- this.listableUserMeta = listableUserMeta;
- this.systemMeta = systemMeta;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.DirectoryItem = DirectoryItem;
-}
diff --git a/AtmosJS/src/HttpRequest.js b/AtmosJS/src/HttpRequest.js
deleted file mode 100644
index 14f5cf1..0000000
--- a/AtmosJS/src/HttpRequest.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * Class to abstract an HTTP request (could use XHR or a form POST)
- * @constructor
- * @param {string} uri the URI of the request
- * @param {string} method the HTTP method to use for the request (GET, POST, PUT, DELETE, HEAD)
- * @param {Object=} headers HTTP headers of the request
- * @param {string|File=} data (only for object creates/updates) data to send (can be a string or File object)
- * @param {string=} mimeType (only for object creates/updates) the mimeType of the data to be sent
- * @param {AtmosRange=} range (optional) the range of bytes of an object to read or update
- * @param {function=} progress (optional) provides progress updates for uploads (progress bar)
- * @param {function=} processResult (optional) provides for custom result processing (result and XHR objects are passed as arguments)
- * @param {function=} complete (optional) called upon completion of the request (called after success or error)
- * @param {Element=} form a form element to use instead of XHR for a POST or PUT request
- */
-HttpRequest = function( uri, method, headers, data, mimeType, range, progress, processResult, complete, form ) {
- this.uri = uri;
- this.method = method;
- this.headers = headers;
- this.data = data;
- this.mimeType = mimeType;
- this.range = range;
- this.progress = progress;
- this.processResult = processResult;
- this.complete = complete;
- this.form = form;
-};
-
-/**
- * The AtmosRange object is used to specify a range of object data to store or retrieve.
- * @param {number} offset the byte offset within an object's data from which to start the range.
- * @param {number} size the number of bytes to include in the range.
- */
-AtmosRange = function( offset, size ) {
- this.offset = offset;
- this.size = size;
-};
-
-AtmosRange.prototype.toString = function() {
- return 'bytes=' + this.offset + '-' + (this.offset + this.size - 1);
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.HttpRequest = HttpRequest;
- exports.AtmosRange = AtmosRange;
-}
diff --git a/AtmosJS/src/ListOptions.js b/AtmosJS/src/ListOptions.js
deleted file mode 100644
index e424593..0000000
--- a/AtmosJS/src/ListOptions.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * Constructs a new ListOptions object. Used for listObjects and listDirectory methods.
- * Note that use of this class is optional; you can simply use a JSON object, e.g.
- * { limit: 0, includeMeta: true }
- * @param {int} limit maximum number of objects to return from server. 0=default (generally
- * the default limit is 5000).
- * @param {string} token server token for continuing results. Check your results object for a
- * token and pass into this field on the subsequent request to continue your listing.
- * @param {boolean} includeMeta if true, object metadata will be returned with the results
- * @param {Array.} userMetaTags if non-null, the list of user metadata tags to return in the metadata
- * (assumes includeMeta=true). If null, all metadata tags will be returned.
- * @param {Array.} systemMetaTags if non-null, the list of system metadata tags to return in the metadata
- * (assumes includeMeta=true). If null, all system metadata tags will be returned.
- * @constructor
- */
-ListOptions = function( limit, token, includeMeta, userMetaTags, systemMetaTags ) {
- this.limit = limit;
- this.token = token;
- this.includeMeta = includeMeta;
- this.userMetaTags = userMetaTags;
- this.systemMetaTags = systemMetaTags;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.ListOptions = ListOptions;
-}
diff --git a/AtmosJS/src/ObjectInfo.js b/AtmosJS/src/ObjectInfo.js
deleted file mode 100644
index 6ef984d..0000000
--- a/AtmosJS/src/ObjectInfo.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * @constructor
- * @param {string} objectId the Object ID of the object
- * @param {string} selection the replica selection for read access. Values can be geographic or random
- * @param {Array.} replicas array of ObjectReplica objects
- * @param {boolean} expirationEnabled whether expiration is enabled for the object
- * @param {Date} expirationEndsAt when this object's expiration period ends
- * @param {boolean} retentionEnabled whether retention is enabled for the object
- * @param {Date} retentionEndsAt when this object's retention period expires
- */
-ObjectInfo = function( objectId, selection, replicas, expirationEnabled, expirationEndsAt, retentionEnabled, retentionEndsAt ) {
- this.objectId = objectId;
- this.selection = selection;
- this.replicas = replicas;
- this.expirationEnabled = expirationEnabled;
- this.expirationEndsAt = expirationEndsAt;
- this.retentionEnabled = retentionEnabled;
- this.retentionEndsAt = retentionEndsAt;
-};
-
-/**
- * @constructor
- * @param {number} id the replica ID
- * @param {string} location the replica location
- * @param {string} replicaType the replica type. Values can be sync or async
- * @param {boolean} current true if the replica is current, or false if the replica is not current
- * @param {string} storageType the replica's storage type. Values can be stripe, normal, cloud, compression, ErasureCode, and dedup
- */
-ObjectReplica = function( id, location, replicaType, current, storageType ) {
- this.id = id;
- this.location = location;
- this.replicaType = replicaType;
- this.current = current;
- this.storageType = storageType;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.ObjectInfo = ObjectInfo;
- exports.ObjectReplica = ObjectReplica;
-}
diff --git a/AtmosJS/src/ObjectResult.js b/AtmosJS/src/ObjectResult.js
deleted file mode 100644
index 4a240ce..0000000
--- a/AtmosJS/src/ObjectResult.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * @param {string} objectId the object's identifier
- * @param {Object} userMeta an object containing the user metadata properties
- * @param {Object} listableUserMeta an object containing the listable user metadata properties
- * @param {Object} systemMeta an object containing the system metadata properties
- * @constructor
- */
-ObjectResult = function( objectId, userMeta, listableUserMeta, systemMeta ) {
- this.id = objectId;
- this.objectId = objectId;
- this.userMeta = userMeta;
- this.listableUserMeta = listableUserMeta;
- this.systemMeta = systemMeta;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.ObjectResult = ObjectResult;
-}
diff --git a/AtmosJS/src/ObjectVersion.js b/AtmosJS/src/ObjectVersion.js
deleted file mode 100644
index 29ae0da..0000000
--- a/AtmosJS/src/ObjectVersion.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-/**
- * Represents object version/snapshot information as returned from the list-versions call.
- * @param num the version/snapshot number (incremented automatically starting at 0)
- * @param oid the object-id of the version/snapshot (can be used to read it)
- * @param dateCreated date the version/snapshot was created
- * @constructor
- */
-ObjectVersion = function( num, oid, dateCreated ) {
- this.num = num;
- this.oid = oid;
- this.dateCreated = dateCreated;
-};
-
-////////////////////////
-// Exports for NodeJS //
-////////////////////////
-if ( typeof(exports) != 'undefined' ) {
- exports.ObjectVersion = ObjectVersion;
-}
diff --git a/AtmosJS/src/compat/AtmosRest20Compat.js b/AtmosJS/src/compat/AtmosRest20Compat.js
deleted file mode 100644
index a161d7e..0000000
--- a/AtmosJS/src/compat/AtmosRest20Compat.js
+++ /dev/null
@@ -1,162 +0,0 @@
-AtmosRest.prototype.getServiceInformation_incompat = AtmosRest.prototype.getServiceInformation;
-AtmosRest.prototype.getServiceInformation = function( state, callback ) {
- this.getServiceInformation_incompat( function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.createObject_incompat = AtmosRest.prototype.createObject;
-AtmosRest.prototype.createObject = function( acl, meta, listableMeta, form, data, mimeType, state, successCallback, progressCallback ) {
- this.createObject_incompat( acl, meta, listableMeta, form, data, mimeType, function( result ) {
- result.state = state;
- successCallback( result );
- }, progressCallback );
-};
-AtmosRest.prototype.createObjectOnPath_incompat = AtmosRest.prototype.createObjectOnPath;
-AtmosRest.prototype.createObjectOnPath = function( path, acl, meta, listableMeta, form, data, mimeType, state, successCallback, progressCallback ) {
- this.createObjectOnPath_incompat( path, acl, meta, listableMeta, form, data, mimeType, function( result ) {
- result.state = state;
- successCallback( result );
- }, progressCallback );
-};
-AtmosRest.prototype.readObject_incompat = AtmosRest.prototype.readObject;
-AtmosRest.prototype.readObject = function( id, range, state, callback ) {
- this.readObject_incompat( id, range, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.updateObject_incompat = AtmosRest.prototype.updateObject;
-AtmosRest.prototype.updateObject = function( id, acl, meta, listableMeta, form, data, range, mimeType, state, successCallback, progressCallback ) {
- this.updateObject_incompat( id, acl, meta, listableMeta, form, data, range, mimeType, function( result ) {
- result.state = state;
- successCallback( result );
- }, progressCallback );
-};
-AtmosRest.prototype.deleteObject_incompat = AtmosRest.prototype.deleteObject;
-AtmosRest.prototype.deleteObject = function( id, state, callback ) {
- this.deleteObject_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.listVersions_incompat = AtmosRest.prototype.listVersions;
-AtmosRest.prototype.listVersions = function( id, state, callback ) {
- this.listVersions_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.versionObject_incompat = AtmosRest.prototype.versionObject;
-AtmosRest.prototype.versionObject = function( id, state, callback ) {
- this.versionObject_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.restoreVersion_incompat = AtmosRest.prototype.restoreVersion;
-AtmosRest.prototype.restoreVersion = function( id, vId, state, callback ) {
- this.restoreVersion_incompat( id, vId, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.deleteVersion_incompat = AtmosRest.prototype.deleteVersion;
-AtmosRest.prototype.deleteVersion = function( vId, state, callback ) {
- this.deleteVersion_incompat( vId, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.rename_incompat = AtmosRest.prototype.rename;
-AtmosRest.prototype.rename = function( oldPath, newPath, force, state, callback ) {
- this.rename_incompat( oldPath, newPath, force, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getAcl_incompat = AtmosRest.prototype.getAcl;
-AtmosRest.prototype.getAcl = function( id, state, callback ) {
- this.getAcl_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.setAcl_incompat = AtmosRest.prototype.setAcl;
-AtmosRest.prototype.setAcl = function( id, acl, state, callback ) {
- this.setAcl_incompat( id, acl, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.listUserMetadataTags_incompat = AtmosRest.prototype.listUserMetadataTags;
-AtmosRest.prototype.listUserMetadataTags = function( id, state, callback ) {
- this.listUserMetadataTags_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getUserMetadata_incompat = AtmosRest.prototype.getUserMetadata;
-AtmosRest.prototype.getUserMetadata = function( id, filter, state, callback ) {
- this.getUserMetadata_incompat( id, filter, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getSystemMetadata_incompat = AtmosRest.prototype.getSystemMetadata;
-AtmosRest.prototype.getSystemMetadata = function( id, filter, state, callback ) {
- this.getSystemMetadata_incompat( id, filter, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getAllMetadata_incompat = AtmosRest.prototype.getAllMetadata;
-AtmosRest.prototype.getAllMetadata = function( id, state, callback ) {
- this.getAllMetadata_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getObjectInfo_incompat = AtmosRest.prototype.getObjectInfo;
-AtmosRest.prototype.getObjectInfo = function( id, state, callback ) {
- this.getObjectInfo_incompat( id, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.setUserMetadata_incompat = AtmosRest.prototype.setUserMetadata;
-AtmosRest.prototype.setUserMetadata = function( id, meta, listableMeta, state, callback ) {
- this.setUserMetadata_incompat( id, meta, listableMeta, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.deleteUserMetadata_incompat = AtmosRest.prototype.deleteUserMetadata;
-AtmosRest.prototype.deleteUserMetadata = function( id, tags, state, callback ) {
- this.deleteUserMetadata_incompat( id, tags, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.getListableTags_incompat = AtmosRest.prototype.getListableTags;
-AtmosRest.prototype.getListableTags = function( tag, state, callback ) {
- this.getListableTags_incompat( tag, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.listObjects_incompat = AtmosRest.prototype.listObjects;
-AtmosRest.prototype.listObjects = function( tag, options, state, callback ) {
- this.listObjects_incompat( tag, options, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.prototype.listDirectory_incompat = AtmosRest.prototype.listDirectory;
-AtmosRest.prototype.listDirectory = function( directory, options, state, callback ) {
- this.listDirectory_incompat( directory, options, function( result ) {
- result.state = state;
- callback( result );
- } );
-};
-AtmosRest.compatibilityMode = true;
\ No newline at end of file
diff --git a/AtmosJS/src/deps.js b/AtmosJS/src/deps.js
deleted file mode 100644
index 04212b2..0000000
--- a/AtmosJS/src/deps.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-
- Copyright (c) 2011-2013, EMC Corporation
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the EMC Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-///////////////////////////////////////////////////
-// Array function backported from JavaScript 1.6 //
-// Needed by some browsers //
-///////////////////////////////////////////////////
-if ( !Array.prototype.forEach ) {
- Array.prototype.forEach = function( fn, scope ) {
- for ( var i = 0, len = this.length; i < len; ++i ) {
- fn.call( scope, this[i], i, this );
- }
- };
-}
-
-//////////////////////////////////////////////////
-// String function backported from ECMAScript-5 //
-// Needed by some browsers //
-//////////////////////////////////////////////////
-if ( !String.prototype.trim ) {
- String.prototype.trim = function() {
- return this.replace( /^\s+|\s+$/g, '' );
- };
-}
-
-//////////////////////////////////////////////////////
-// String function backported from JavaScript 1.8.6 //
-// Needed by some browsers and node.js //
-//////////////////////////////////////////////////////
-if ( !String.prototype.startsWith ) {
- String.prototype.startsWith = function( searchString, position ) {
- position = position || 0;
- return this.indexOf( searchString, position ) === position;
- };
-}
-
-//////////////////////////////////////////////////
-// Object function backported from ECMAScript-5 //
-// Needed by some browsers //
-//////////////////////////////////////////////////
-if ( !Object.keys ) {
- Object.keys = (function() {
- var hasOwnProperty = Object.prototype.hasOwnProperty,
- hasDontEnumBug = !({toString: null}).propertyIsEnumerable( 'toString' ),
- dontEnums = [
- 'toString',
- 'toLocaleString',
- 'valueOf',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'constructor'
- ],
- dontEnumsLength = dontEnums.length;
-
- return function( obj ) {
- if ( typeof obj !== 'object' && typeof obj !== 'function' || obj === null )
- throw new TypeError( 'Object.keys called on non-object' );
-
- var result = [];
-
- for ( var prop in obj ) {
- if ( hasOwnProperty.call( obj, prop ) ) result.push( prop );
- }
-
- if ( hasDontEnumBug ) {
- for ( var i = 0; i < dontEnumsLength; i++ ) {
- if ( hasOwnProperty.call( obj, dontEnums[i] ) ) result.push( dontEnums[i] );
- }
- }
- return result;
- }
- })();
-}
-
-//////////////////////////////////////////////////
-// Date function backported from ECMAScript-5 //
-// Needed by some browsers //
-//////////////////////////////////////////////////
-if ( !Date.prototype.toISOString ) {
- (function() {
- function pad( number ) {
- var r = String( number );
- if ( r.length === 1 ) {
- r = '0' + r;
- }
- return r;
- }
-
- Date.prototype.toISOString = function() {
- return this.getUTCFullYear()
- + '-' + pad( this.getUTCMonth() + 1 )
- + '-' + pad( this.getUTCDate() )
- + 'T' + pad( this.getUTCHours() )
- + ':' + pad( this.getUTCMinutes() )
- + ':' + pad( this.getUTCSeconds() )
- + '.' + String( (this.getUTCMilliseconds() / 1000).toFixed( 3 ) ).slice( 2, 5 )
- + 'Z';
- };
- })();
-}
diff --git a/AtmosJS/testcases-compat.html b/AtmosJS/testcases-compat.html
deleted file mode 100644
index 62fd131..0000000
--- a/AtmosJS/testcases-compat.html
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
-
-
- AtmosJS Unit Tests
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
AtmosJS Unit Tests
-
-
-
-
-Test multipart upload:
-
-
-
-
\ No newline at end of file
diff --git a/AtmosJS/testcases-min.html b/AtmosJS/testcases-min.html
deleted file mode 100644
index f6d7a16..0000000
--- a/AtmosJS/testcases-min.html
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
- AtmosJS Unit Tests
-
-
-
-
-
-
-
-
-
-
-