From 553ccf099cc2f3f417aa9a46bc22e546bf69ba21 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 3 Apr 2013 18:20:37 +0200 Subject: [PATCH 01/14] remove addtogroup blocks --- lib/Basics/StringUtils.cpp | 36 ++++++++-------- lib/V8/v8-conv.cpp | 4 ++ lib/V8/v8-globals.h | 4 ++ lib/V8/v8-utils.cpp | 86 ++++++++++++-------------------------- utils/cleanupCFiles | 52 ++++++++++++++++++++++- 5 files changed, 103 insertions(+), 79 deletions(-) diff --git a/lib/Basics/StringUtils.cpp b/lib/Basics/StringUtils.cpp index 4cfa3db35a..dacbf37cf7 100644 --- a/lib/Basics/StringUtils.cpp +++ b/lib/Basics/StringUtils.cpp @@ -239,9 +239,9 @@ namespace triagens { namespace basics { namespace StringUtils { -// ----------------------------------------------------------------------------- + // ............................................................................. // STRING AND STRING POINTER -// ----------------------------------------------------------------------------- + // ............................................................................. blob_t duplicateBlob (const blob_t& source) { blob_t result = {0,0}; @@ -392,9 +392,9 @@ namespace triagens { } } -// ----------------------------------------------------------------------------- + // ............................................................................. // STRING CONVERSION -// ----------------------------------------------------------------------------- + // ............................................................................. string capitalize (string const& name, bool first) { size_t len = name.length(); @@ -1633,9 +1633,9 @@ namespace triagens { return result; } -// ----------------------------------------------------------------------------- + // ............................................................................. // CONVERT TO STRING -// ----------------------------------------------------------------------------- + // ............................................................................. string itoa (int16_t attr) { char buffer[7]; @@ -1815,9 +1815,9 @@ namespace triagens { return result; } -// ----------------------------------------------------------------------------- + // ............................................................................. // CONVERT FROM STRING -// ----------------------------------------------------------------------------- + // ............................................................................. bool boolean (string const& str) { string lower = tolower(trim(str)); @@ -2914,9 +2914,9 @@ namespace triagens { } -// ----------------------------------------------------------------------------- + // ............................................................................. // UTF8 -// ----------------------------------------------------------------------------- + // ............................................................................. // this function takes a sequence of hexadecimal characters (inputStr) of a particular // length (len) and output 1,2,3 or 4 characters which represents the utf8 encoding @@ -2943,9 +2943,9 @@ namespace triagens { } -// ----------------------------------------------------------------------------- + // ............................................................................. // UTF16 -// ----------------------------------------------------------------------------- + // ............................................................................. // this function converts unicode symbols whose code points lies in U+10000 to U+10FFFF // @@ -2976,9 +2976,9 @@ namespace triagens { return ok; } -// ----------------------------------------------------------------------------- + // ............................................................................. // BASE64 -// ----------------------------------------------------------------------------- + // ............................................................................. string encodeBase64 (string const& in) { unsigned char charArray3[3]; @@ -3198,9 +3198,9 @@ namespace triagens { return ret; } -// ----------------------------------------------------------------------------- + // ............................................................................. // ADDITIONAL STRING UTILITIES -// ----------------------------------------------------------------------------- + // ............................................................................. string correctPath(const string& incorrectPath) { #ifdef _WIN32 @@ -3210,8 +3210,8 @@ namespace triagens { #endif } -/// In a list str = "xx,yy,zz ...", entry(n,str,',') returns the nth entry of the list delimited -/// by ','. E.g entry(2,str,',') = 'yy' + // In a list str = "xx,yy,zz ...", entry(n,str,',') returns the nth entry of the list delimited + // by ','. E.g entry(2,str,',') = 'yy' string entry (const size_t pos, string const& sourceStr, string const& delimiter) { size_t delLength = delimiter.length(); diff --git a/lib/V8/v8-conv.cpp b/lib/V8/v8-conv.cpp index 1240806156..46eefee5cb 100644 --- a/lib/V8/v8-conv.cpp +++ b/lib/V8/v8-conv.cpp @@ -1676,6 +1676,10 @@ void TRI_InitV8Conversions (v8::Handle context) { /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}" diff --git a/lib/V8/v8-globals.h b/lib/V8/v8-globals.h index 717f8b9e90..dc6e0eefb7 100644 --- a/lib/V8/v8-globals.h +++ b/lib/V8/v8-globals.h @@ -595,6 +595,10 @@ void TRI_AddGlobalVariableVocbase (v8::Handle context, #endif +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}" diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index 4e97495243..1d719a7f71 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -29,10 +29,10 @@ #include "BasicsC/win-utils.h" #endif -#include "build.h" - #include "v8-utils.h" +#include "build.h" + #include #include @@ -86,11 +86,6 @@ namespace { // --SECTION-- public classes // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Utils -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief Converts an object to a UTF-8-encoded and normalized character array. //////////////////////////////////////////////////////////////////////////////// @@ -110,19 +105,10 @@ TRI_Utf8ValueNFC::~TRI_Utf8ValueNFC () { } } -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- private functions // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Utils -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief create a Javascript error object //////////////////////////////////////////////////////////////////////////////// @@ -133,9 +119,9 @@ static v8::Handle CreateErrorObject (int errorNumber, string const& TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); v8::Handle errorMessage = v8::String::New(message.c_str(), message.size()); - + v8::Handle errorObject = v8::Exception::Error(errorMessage)->ToObject(); - + errorObject->Set(v8::String::New("errorNum"), v8::Number::New(errorNumber)); errorObject->Set(v8::String::New("errorMessage"), errorMessage); @@ -289,19 +275,10 @@ static void FillDistribution (v8::Handle list, list->Set(TRI_V8_SYMBOL(name), result); } -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- JS functions // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Utils -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief parse a Javascript snippet, but do not execute it /// @@ -356,13 +333,13 @@ static v8::Handle JS_Parse (v8::Arguments const& argv) { /// /// @FUN{internal.download(@FA{url}, @FA{method}, @FA{outfile}, @FA{timeout})} /// -/// Downloads the data from the URL specified by @FA{url} and saves the +/// Downloads the data from the URL specified by @FA{url} and saves the /// response body to @FA{outfile}. //////////////////////////////////////////////////////////////////////////////// static v8::Handle JS_Download (v8::Arguments const& argv) { v8::HandleScope scope; - + if (argv.Length() < 3) { TRI_V8_EXCEPTION_USAGE(scope, "download(, , , )"); } @@ -423,7 +400,7 @@ static v8::Handle JS_Download (v8::Arguments const& argv) { else { TRI_V8_SYNTAX_ERROR(scope, "unsupported URL specified"); } - + LOGGER_TRACE("downloading file. endpoint: " << endpoint << ", relative URL: " << url); GeneralClientConnection* connection = GeneralClientConnection::factory(Endpoint::clientFactory(endpoint), timeout, timeout, 3); @@ -491,7 +468,7 @@ static v8::Handle JS_Download (v8::Arguments const& argv) { } } } - + result->Set(v8::String::New("code"), v8::Number::New(returnCode)); result->Set(v8::String::New("message"), v8::String::New(returnMessage.c_str())); @@ -502,7 +479,7 @@ static v8::Handle JS_Download (v8::Arguments const& argv) { delete connection; return scope.Close(result); } - + TRI_V8_EXCEPTION_INTERNAL(scope, "too many redirects"); } @@ -732,8 +709,8 @@ static v8::Handle JS_GetTempPath (v8::Arguments const& argv) { /// /// @FUN{fs.getTempFile(@FA{directory}, @FA{createFile})} /// -/// Returns the name for a new temporary file in directory @FA{directory}. -/// If @FA{createFile} is @LIT{true}, an empty file will be created so no other +/// Returns the name for a new temporary file in directory @FA{directory}. +/// If @FA{createFile} is @LIT{true}, an empty file will be created so no other /// process can create a file of the same name. /// /// Note that the directory @FA{directory} must exist. @@ -857,7 +834,7 @@ static v8::Handle JS_List (v8::Arguments const& argv) { uint32_t j = 0; for (size_t i = 0; i < list._length; ++i) { - const char* f = list._buffer[i]; + const char* f = list._buffer[i]; result->Set(j++, v8::String::New(f)); } @@ -900,7 +877,7 @@ static v8::Handle JS_ListTree (v8::Arguments const& argv) { uint32_t j = 0; for (size_t i = 0; i < list._length; ++i) { - const char* f = list._buffer[i]; + const char* f = list._buffer[i]; result->Set(j++, v8::String::New(f)); } @@ -920,7 +897,7 @@ static v8::Handle JS_ListTree (v8::Arguments const& argv) { static v8::Handle JS_MakeDirectory (v8::Arguments const& argv) { v8::HandleScope scope; - + // 2nd argument (permissions) are ignored for now // extract arguments @@ -1021,8 +998,8 @@ static v8::Handle JS_ZipFile (v8::Arguments const& argv) { } v8::Handle files = v8::Handle::Cast(argv[2]); - - int res = TRI_ERROR_NO_ERROR; + + int res = TRI_ERROR_NO_ERROR; TRI_vector_string_t filenames; TRI_InitVectorString(&filenames, TRI_UNKNOWN_MEM_ZONE); @@ -1043,8 +1020,8 @@ static v8::Handle JS_ZipFile (v8::Arguments const& argv) { TRI_V8_EXCEPTION_USAGE(scope, "zip(, , )"); } - - const char* p; + + const char* p; string password; if (argv.Length() == 4) { password = TRI_ObjectToString(argv[3]); @@ -1602,7 +1579,7 @@ static v8::Handle JS_Remove (v8::Arguments const& argv) { if (argv.Length() != 1) { TRI_V8_EXCEPTION_USAGE(scope, "remove()"); } - + TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]); if (*name == 0) { @@ -1634,7 +1611,7 @@ static v8::Handle JS_RemoveDirectory (v8::Arguments const& argv) { if (argv.Length() != 1) { TRI_V8_EXCEPTION_USAGE(scope, "removeDirectory()"); } - + TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]); if (*name == 0) { @@ -1659,7 +1636,7 @@ static v8::Handle JS_RemoveDirectory (v8::Arguments const& argv) { /// /// @FUN{fs.removeDirectoryRecursive(@FA{path})} /// -/// Removes a directory with all subelements. Throws an exception if the path +/// Removes a directory with all subelements. Throws an exception if the path /// is not a directory. //////////////////////////////////////////////////////////////////////////////// @@ -1670,7 +1647,7 @@ static v8::Handle JS_RemoveRecursiveDirectory (v8::Arguments const& a if (argv.Length() != 1) { TRI_V8_EXCEPTION_USAGE(scope, "removeDirectoryRecursive()"); } - + TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]); if (*name == 0) { @@ -1680,7 +1657,7 @@ static v8::Handle JS_RemoveRecursiveDirectory (v8::Arguments const& a if (! TRI_IsDirectory(*name)) { TRI_V8_EXCEPTION_PARAMETER(scope, " must be a valid directory name"); } - + if (TempPath.size() < 8) { // some security measure so we don't accidently delete all our files TRI_V8_EXCEPTION_PARAMETER(scope, "temporary directory name is too short. will not remove directory"); @@ -1943,19 +1920,10 @@ static v8::Handle JS_RequestStatistics (v8::Arguments const& argv) { return scope.Close(result); } -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Utils -/// @{ -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @brief adds attributes to array //////////////////////////////////////////////////////////////////////////////// @@ -2350,7 +2318,7 @@ void TRI_InitV8Utils (v8::Handle context, // ............................................................................. // generate the general error template // ............................................................................. - + ft = v8::FunctionTemplate::New(); ft->SetClassName(TRI_V8_SYMBOL("ArangoError")); @@ -2422,9 +2390,9 @@ void TRI_InitV8Utils (v8::Handle context, TRI_AddGlobalVariableVocbase(context, "SYS_PLATFORM", v8::String::New(TRI_PLATFORM)); } -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- // Local Variables: // mode: outline-minor diff --git a/utils/cleanupCFiles b/utils/cleanupCFiles index 90b6a380a6..c6c45de095 100755 --- a/utils/cleanupCFiles +++ b/utils/cleanupCFiles @@ -166,6 +166,9 @@ sub formatFile ($$$) { || die "cannot open output file '$file.new'"; } + my $lastLine = undef; + my $skipGroup = 0; + while () { chomp; @@ -175,11 +178,51 @@ sub formatFile ($$$) { my $line = $_; $breakLine = 0; + if ($line =~ /^\/\/\/ \@addtogroup/) { + $lastLine = undef; + $skipGroup = 1; + print STDERR "skip group 1\n"; + next; + } + + if ($line =~ /^\/\/\/ @}/) { + $lastLine = undef; + $skipGroup = 1; + print STDERR "skip group 1a\n"; + next; + } + + if ($skipGroup == 1) { + if ($line =~ /^\/\/\/\/\/\//) { + $skipGroup = 2; + print STDERR "skip group 2\n"; + print STDERR "$line\n"; + } + + next; + } + + if ($skipGroup == 2) { + if ($line !~ /^[\t ]*$/) { + $skipGroup = 0; + print STDERR "skip group 0\n"; + print STDERR "$line\n"; + } + else { + next; + } + } + + if (defined $lastLine) { + print $out "$lastLine\n"; + $lastLine = undef; + } + if ($line eq '/// @author Dr. O') { $line = '/// @author Dr. Oreste Costa-Panaia'; } - if ($line =~ /\/\/ outline-regexp:/) { + if ($line =~ /^\/\/ outline-regexp:/) { if ($isJavaScript == 1) { $line = '// outline-regexp: "/// @brief\\\\|/// @addtogroup\\\\|/// @page\\\\|// --SECTION--\\\\|/// @\\\\}\\\\|/\\\\*jslint"'; } @@ -297,10 +340,15 @@ sub formatFile ($$$) { } if (! $dryRun || ! $preambleDone) { - print $out "$line\n"; + $lastLine = $line; } } + if (defined $lastLine) { + print $out "$lastLine\n"; + $lastLine = undef; + } + if (! $dryRun) { close($out) || die "cannot close output file '$file.new'"; From 1d7ee507e2197dea12c212ae1fcedc63853fc5d4 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 10:18:29 +0200 Subject: [PATCH 02/14] added TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING --- .../Examples/AdminStatistics1.generated | 42 +-- .../Examples/AuthenticationExample1.generated | 8 +- .../HandlingDocumentsExample1.generated | 2 +- .../RestDocumentHandlerPostAccept1.generated | 12 +- .../RestDocumentHandlerPostCreate1.generated | 10 +- .../RestDocumentHandlerPostCreate2.generated | 10 +- ...entHandlerPostUnknownCollection1.generated | 4 +- .../RestDocumentHandlerPostWait1.generated | 12 +- .../Examples/RestReadDocument.generated | 10 +- .../Examples/RestReadDocumentAll.generated | 8 +- .../Examples/RestReadDocumentHead.generated | 7 +- .../RestReadDocumentIfNoneMatch.generated | 13 +- .../Examples/RestUpdateDocument.generated | 14 +- .../RestUpdateDocumentIfMatchOther.generated | 14 +- ...ateDocumentIfMatchOtherLastWrite.generated | 14 +- .../RestUpdateDocumentRevOther.generated | 14 +- .../RestUpdateDocumentUnknownHandle.generated | 14 +- Documentation/Examples/setup-arangosh.js | 2 + Documentation/Scripts/generateExamples.py | 12 +- arangod/Ahuacatl/ahuacatl-grammar.c | 86 +++--- arangod/V8Server/v8-vocbase.cpp | 289 ++++++++++++++---- html/admin/js/bootstrap/errors.js | 1 + js/client/modules/org/arangodb/aal.js | 60 +++- js/common/bootstrap/errors.js | 1 + .../modules/org/arangodb/foxx-manager.js | 2 +- js/server/version-check.js | 22 +- lib/BasicsC/errors.dat | 1 + lib/BasicsC/voc-errors.c | 1 + lib/BasicsC/voc-errors.h | 12 + 29 files changed, 441 insertions(+), 256 deletions(-) diff --git a/Documentation/Examples/AdminStatistics1.generated b/Documentation/Examples/AdminStatistics1.generated index 2fc0c1f959..706176849e 100644 --- a/Documentation/Examples/AdminStatistics1.generated +++ b/Documentation/Examples/AdminStatistics1.generated @@ -5,13 +5,13 @@ content-type: application/json; charset=utf-8 { "system" : { - "minorPageFaults" : 15867, - "majorPageFaults" : 68, - "userTime" : 0.74, - "systemTime" : 0.13, - "numberThreads" : 15, - "residentSize" : 5876, - "virtualSize" : 3469815808 + "minorPageFaults" : 18666, + "majorPageFaults" : 57, + "userTime" : 1.162991, + "systemTime" : 0.464635, + "numberThreads" : 0, + "residentSize" : 34525184, + "virtualSize" : 0 }, "client" : { "httpConnections" : 1, @@ -25,33 +25,33 @@ content-type: application/json; charset=utf-8 ] }, "totalTime" : { - "count" : 48, + "count" : 54, "counts" : [ - 46, + 51, 0, 0, 0, 0, 0, - 2 + 3 ] }, "requestTime" : { - "count" : 48, + "count" : 54, "counts" : [ - 46, + 51, 0, 0, 0, 0, 0, - 2 + 3 ] }, "queueTime" : { - "count" : 47, + "count" : 53, "counts" : [ - 47, + 53, 0, 0, 0, @@ -61,20 +61,20 @@ content-type: application/json; charset=utf-8 ] }, "bytesSent" : { - "count" : 48, + "count" : 54, "counts" : [ - 8, - 39, - 0, + 13, + 27, + 13, 1, 0, 0 ] }, "bytesReceived" : { - "count" : 48, + "count" : 54, "counts" : [ - 46, + 52, 2, 0, 0, diff --git a/Documentation/Examples/AuthenticationExample1.generated b/Documentation/Examples/AuthenticationExample1.generated index a15042a501..ebf484cbaa 100644 --- a/Documentation/Examples/AuthenticationExample1.generated +++ b/Documentation/Examples/AuthenticationExample1.generated @@ -1,8 +1,8 @@ { - "_id" : "_users/1585754", - "_rev" : "1585754", - "_key" : "1585754", + "_id" : "_users/1589671", + "_rev" : "1589671", + "_key" : "1589671", "active" : true, "user" : "root", - "password" : "$1$5197b9af$45f98c0c777bd2b59e767ec75eeb1351f5a11eac4e1f40425c3f84ba83553903" + "password" : "$1$e0d13aed$328469fc501398de5c3626dcc0a5a567e01b4bafbc06d89c0a5cf2b09872ca14" } diff --git a/Documentation/Examples/HandlingDocumentsExample1.generated b/Documentation/Examples/HandlingDocumentsExample1.generated index 907ca6e6ed..7a8ccee34c 100644 --- a/Documentation/Examples/HandlingDocumentsExample1.generated +++ b/Documentation/Examples/HandlingDocumentsExample1.generated @@ -11,6 +11,6 @@ "programming" ], "_id" : "demo/schlonz", - "_rev" : "9908826", + "_rev" : "12468647", "_key" : "schlonz" } diff --git a/Documentation/Examples/RestDocumentHandlerPostAccept1.generated b/Documentation/Examples/RestDocumentHandlerPostAccept1.generated index 87c662fed0..806b1407b9 100644 --- a/Documentation/Examples/RestDocumentHandlerPostAccept1.generated +++ b/Documentation/Examples/RestDocumentHandlerPostAccept1.generated @@ -1,15 +1,15 @@ -unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsNoWait +unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products { "Hello": "World" } HTTP/1.1 202 Accepted content-type: application/json; charset=utf-8 -etag: "16069210" -location: /_api/document/productsNoWait/16069210 +etag: "21316007" +location: /_api/document/products/21316007 { "error" : false, - "_id" : "productsNoWait/16069210", - "_rev" : "16069210", - "_key" : "16069210" + "_id" : "products/21316007", + "_rev" : "21316007", + "_key" : "21316007" } diff --git a/Documentation/Examples/RestDocumentHandlerPostCreate1.generated b/Documentation/Examples/RestDocumentHandlerPostCreate1.generated index f377e20d90..7f44be9986 100644 --- a/Documentation/Examples/RestDocumentHandlerPostCreate1.generated +++ b/Documentation/Examples/RestDocumentHandlerPostCreate1.generated @@ -3,13 +3,13 @@ unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collec HTTP/1.1 201 Created content-type: application/json; charset=utf-8 -etag: "13251162" -location: /_api/document/products/13251162 +etag: "17973671" +location: /_api/document/products/17973671 { "error" : false, - "_id" : "products/13251162", - "_rev" : "13251162", - "_key" : "13251162" + "_id" : "products/17973671", + "_rev" : "17973671", + "_key" : "17973671" } diff --git a/Documentation/Examples/RestDocumentHandlerPostCreate2.generated b/Documentation/Examples/RestDocumentHandlerPostCreate2.generated index 13287fc5ba..1e06b19c55 100644 --- a/Documentation/Examples/RestDocumentHandlerPostCreate2.generated +++ b/Documentation/Examples/RestDocumentHandlerPostCreate2.generated @@ -3,13 +3,13 @@ unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collec HTTP/1.1 202 Accepted content-type: application/json; charset=utf-8 -etag: "23999066" -location: /_api/document/products/23999066 +etag: "29049255" +location: /_api/document/products/29049255 { "error" : false, - "_id" : "products/23999066", - "_rev" : "23999066", - "_key" : "23999066" + "_id" : "products/29049255", + "_rev" : "29049255", + "_key" : "29049255" } diff --git a/Documentation/Examples/RestDocumentHandlerPostUnknownCollection1.generated b/Documentation/Examples/RestDocumentHandlerPostUnknownCollection1.generated index 43e34b98c8..d2633137e0 100644 --- a/Documentation/Examples/RestDocumentHandlerPostUnknownCollection1.generated +++ b/Documentation/Examples/RestDocumentHandlerPostUnknownCollection1.generated @@ -1,4 +1,4 @@ -unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsUnknown +unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products { "Hello": "World" } HTTP/1.1 404 Not Found @@ -6,7 +6,7 @@ content-type: application/json; charset=utf-8 { "error" : true, - "errorMessage" : "collection /_api/collection/productsUnknown not found", + "errorMessage" : "collection /_api/collection/products not found", "code" : 404, "errorNum" : 1203 } diff --git a/Documentation/Examples/RestDocumentHandlerPostWait1.generated b/Documentation/Examples/RestDocumentHandlerPostWait1.generated index 69ed886ec9..813a07d500 100644 --- a/Documentation/Examples/RestDocumentHandlerPostWait1.generated +++ b/Documentation/Examples/RestDocumentHandlerPostWait1.generated @@ -1,15 +1,15 @@ -unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsNoWait&waitForSync=true +unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true { "Hello": "World" } HTTP/1.1 201 Created content-type: application/json; charset=utf-8 -etag: "14627418" -location: /_api/document/productsNoWait/14627418 +etag: "19743143" +location: /_api/document/products/19743143 { "error" : false, - "_id" : "productsNoWait/14627418", - "_rev" : "14627418", - "_key" : "14627418" + "_id" : "products/19743143", + "_rev" : "19743143", + "_key" : "19743143" } diff --git a/Documentation/Examples/RestReadDocument.generated b/Documentation/Examples/RestReadDocument.generated index b952c95cb6..127732c31e 100644 --- a/Documentation/Examples/RestReadDocument.generated +++ b/Documentation/Examples/RestReadDocument.generated @@ -1,13 +1,13 @@ -unix> curl --dump - http://localhost:8529/_api/document/products1/19214938 +unix> curl --dump - http://localhost:8529/_api/document/products/24265127 HTTP/1.1 200 OK content-type: application/json; charset=utf-8 -etag: "19214938" +etag: "24265127" { "hallo" : "world", - "_id" : "products1/19214938", - "_rev" : "19214938", - "_key" : "19214938" + "_id" : "products/24265127", + "_rev" : "24265127", + "_key" : "24265127" } diff --git a/Documentation/Examples/RestReadDocumentAll.generated b/Documentation/Examples/RestReadDocumentAll.generated index da9e9dfd24..697612e5b6 100644 --- a/Documentation/Examples/RestReadDocumentAll.generated +++ b/Documentation/Examples/RestReadDocumentAll.generated @@ -1,13 +1,13 @@ -unix> curl --dump - http://localhost:8529/_api/document/?collection=24457818 +unix> curl --dump - http://localhost:8529/_api/document/?collection=products HTTP/1.1 200 OK content-type: application/json; charset=utf-8 { "documents" : [ - "/_api/document/products3/26358362", - "/_api/document/products3/25440858", - "/_api/document/products3/26096218" + "/_api/document/products/31408551", + "/_api/document/products/31146407", + "/_api/document/products/30622119" ] } diff --git a/Documentation/Examples/RestReadDocumentHead.generated b/Documentation/Examples/RestReadDocumentHead.generated index 5596a3a23b..25bc574b19 100644 --- a/Documentation/Examples/RestReadDocumentHead.generated +++ b/Documentation/Examples/RestReadDocumentHead.generated @@ -1,3 +1,6 @@ -unix> curl --data @- --dump - http://localhost:8529/_api/document/productshead/32256602 -{} +unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/37306791 + +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +etag: "37306791" diff --git a/Documentation/Examples/RestReadDocumentIfNoneMatch.generated b/Documentation/Examples/RestReadDocumentIfNoneMatch.generated index ccc39173e0..57e5073e07 100644 --- a/Documentation/Examples/RestReadDocumentIfNoneMatch.generated +++ b/Documentation/Examples/RestReadDocumentIfNoneMatch.generated @@ -1,13 +1,2 @@ -unix> curl --header 'if-none-match: "29110874"' --dump - http://localhost:8529/_api/document/products2/29110874 - -HTTP/1.1 200 OK -content-type: application/json; charset=utf-8 -etag: "29110874" - -{ - "hallo" : "world", - "_id" : "products2/29110874", - "_rev" : "29110874", - "_key" : "29110874" -} +unix> curl --header 'if-none-match: "34292135"' --dump - http://localhost:8529/_api/document/products/34292135 diff --git a/Documentation/Examples/RestUpdateDocument.generated b/Documentation/Examples/RestUpdateDocument.generated index 39d317a73d..72bb70f172 100644 --- a/Documentation/Examples/RestUpdateDocument.generated +++ b/Documentation/Examples/RestUpdateDocument.generated @@ -1,15 +1,3 @@ -unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products4/27472474 +unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/32653735 {} -HTTP/1.1 202 Accepted -content-type: application/json; charset=utf-8 -etag: "28062298" -location: /_api/document/products4/27472474 - -{ - "error" : false, - "_id" : "products4/27472474", - "_rev" : "28062298", - "_key" : "27472474" -} - diff --git a/Documentation/Examples/RestUpdateDocumentIfMatchOther.generated b/Documentation/Examples/RestUpdateDocumentIfMatchOther.generated index f563ef59a5..3ed76180c2 100644 --- a/Documentation/Examples/RestUpdateDocumentIfMatchOther.generated +++ b/Documentation/Examples/RestUpdateDocumentIfMatchOther.generated @@ -1,15 +1,3 @@ -unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products6/22360666 +unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/27410855 {} -HTTP/1.1 202 Accepted -content-type: application/json; charset=utf-8 -etag: "22950490" -location: /_api/document/products6/22360666 - -{ - "error" : false, - "_id" : "products6/22360666", - "_rev" : "22950490", - "_key" : "22360666" -} - diff --git a/Documentation/Examples/RestUpdateDocumentIfMatchOtherLastWrite.generated b/Documentation/Examples/RestUpdateDocumentIfMatchOtherLastWrite.generated index d843933681..15072ed302 100644 --- a/Documentation/Examples/RestUpdateDocumentIfMatchOtherLastWrite.generated +++ b/Documentation/Examples/RestUpdateDocumentIfMatchOtherLastWrite.generated @@ -1,15 +1,3 @@ -unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products7/17642074 +unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/22757799 {} -HTTP/1.1 202 Accepted -content-type: application/json; charset=utf-8 -etag: "18100826" -location: /_api/document/products7/17642074 - -{ - "error" : false, - "_id" : "products7/17642074", - "_rev" : "18100826", - "_key" : "17642074" -} - diff --git a/Documentation/Examples/RestUpdateDocumentRevOther.generated b/Documentation/Examples/RestUpdateDocumentRevOther.generated index 2e3fea4f06..690c01272e 100644 --- a/Documentation/Examples/RestUpdateDocumentRevOther.generated +++ b/Documentation/Examples/RestUpdateDocumentRevOther.generated @@ -1,15 +1,3 @@ -unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products8/20722266 +unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/25903527 {} -HTTP/1.1 202 Accepted -content-type: application/json; charset=utf-8 -etag: "21312090" -location: /_api/document/products8/20722266 - -{ - "error" : false, - "_id" : "products8/20722266", - "_rev" : "21312090", - "_key" : "20722266" -} - diff --git a/Documentation/Examples/RestUpdateDocumentUnknownHandle.generated b/Documentation/Examples/RestUpdateDocumentUnknownHandle.generated index f67e496ef1..f8c763ac45 100644 --- a/Documentation/Examples/RestUpdateDocumentUnknownHandle.generated +++ b/Documentation/Examples/RestUpdateDocumentUnknownHandle.generated @@ -1,15 +1,3 @@ -unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products5/30618202 +unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/35799463 {} -HTTP/1.1 202 Accepted -content-type: application/json; charset=utf-8 -etag: "31208026" -location: /_api/document/products5/30618202 - -{ - "error" : false, - "_id" : "products5/30618202", - "_rev" : "31208026", - "_key" : "30618202" -} - diff --git a/Documentation/Examples/setup-arangosh.js b/Documentation/Examples/setup-arangosh.js index 278af5c1f1..4ada00dcf0 100644 --- a/Documentation/Examples/setup-arangosh.js +++ b/Documentation/Examples/setup-arangosh.js @@ -15,3 +15,5 @@ db.demo.save({ ] }); +db._drop("animals"); +db._create("animals"); diff --git a/Documentation/Scripts/generateExamples.py b/Documentation/Scripts/generateExamples.py index 905020d2e3..31244801a5 100644 --- a/Documentation/Scripts/generateExamples.py +++ b/Documentation/Scripts/generateExamples.py @@ -216,6 +216,7 @@ for filename in argv: def generateArangoshOutput(): print "var internal = require('internal');" + print "var fs = require('fs');" print "var ArangoshOutput = {};" print "internal.startPrettyPrint(true);" print "internal.stopColorPrint(true);" @@ -242,7 +243,7 @@ def generateArangoshOutput(): print "}());" for key in ArangoshOutput: - print "internal.write('%s/%s.generated', ArangoshOutput['%s']);" % (OutputDir, key, key) + print "fs.write('%s/%s.generated', ArangoshOutput['%s']);" % (OutputDir, key, key) ################################################################################ ### @brief generate arangosh run @@ -250,6 +251,7 @@ def generateArangoshOutput(): def generateArangoshRun(): print "var internal = require('internal');" + print "var fs = require('fs');" print "var ArangoshRun = {};" print "internal.startPrettyPrint(true);" print "internal.stopColorPrint(true);" @@ -267,21 +269,21 @@ def generateArangoshRun(): value = ArangoshRun[key] print "(function() {" - print "internal.output('\\n%s\\nRUN STARTING: %s\\n%s\\n');" % ('#' * 80, key, '#' * 80) + print "internal.output('RUN STARTING: %s\\n');" % key print "var output = '';" print "var appender = function(text) { output += text; };" print "var logCurlRequestRaw = require('internal').appendCurlRequest(appender);" print "var logCurlRequest = function () { var r = logCurlRequestRaw.apply(logCurlRequestRaw, arguments); db._collections(); return r; };" print "var logJsonResponse = require('internal').appendJsonResponse(appender);" - print "var assert = function(a) { if (! a) { internal.output('%s\\nASSERTION FAILED: %s\\n%s\\n'); } };" % ('#' * 80, key, '#' * 80) - print "try { %s internal.output('\\n%s\\nRUN SUCCEEDED: %s\\n%s\\n'); } catch (err) { print('%s\\nRUN FAILED: %s, ', err, '\\n%s\\n'); }" % (value, '#' * 80, key, '#' * 80, '#' * 80, key, '#' * 80) + print "var assert = function(a) { if (! a) { internal.output('%s\\nASSERTION FAILED: %s\\n%s\\n'); throw new Error('assertion failed'); } };" % ('#' * 80, key, '#' * 80) + print "try { %s internal.output('RUN SUCCEEDED: %s'); } catch (err) { print('%s\\nRUN FAILED: %s, ', err, '\\n%s\\n'); }" % (value, key, '#' * 80, key, '#' * 80) print "ArangoshRun['%s'] = output;" % key if JS_DEBUG: print "internal.output('%s', ':\\n', output, '\\n%s\\n');" % (key, '-' * 80) print "}());" for key in ArangoshRun: - print "internal.write('%s/%s.generated', ArangoshRun['%s']);" % (OutputDir, key, key) + print "fs.write('%s/%s.generated', ArangoshRun['%s']);" % (OutputDir, key, key) ################################################################################ ### @brief main diff --git a/arangod/Ahuacatl/ahuacatl-grammar.c b/arangod/Ahuacatl/ahuacatl-grammar.c index b501f6c7dc..e74911be16 100644 --- a/arangod/Ahuacatl/ahuacatl-grammar.c +++ b/arangod/Ahuacatl/ahuacatl-grammar.c @@ -1810,7 +1810,7 @@ yyreduce: } node = TRI_CreateNodeForAql(context, (yyvsp[(2) - (4)].strval), (yyvsp[(4) - (4)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1826,7 +1826,7 @@ yyreduce: #line 225 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeFilterAql(context, (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1842,7 +1842,7 @@ yyreduce: #line 238 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLetAql(context, (yyvsp[(2) - (4)].strval), (yyvsp[(4) - (4)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1859,7 +1859,7 @@ yyreduce: { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1873,7 +1873,7 @@ yyreduce: #line 259 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeCollectAql(context, TRI_PopStackParseAql(context), (yyvsp[(4) - (4)].strval)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1905,7 +1905,7 @@ yyreduce: #line 279 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeAssignAql(context, (yyvsp[(1) - (3)].strval), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1940,7 +1940,7 @@ yyreduce: { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1955,7 +1955,7 @@ yyreduce: { TRI_aql_node_t* list = TRI_PopStackParseAql(context); TRI_aql_node_t* node = TRI_CreateNodeSortAql(context, list); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -1993,7 +1993,7 @@ yyreduce: #line 336 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeSortElementAql(context, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].boolval)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2034,7 +2034,7 @@ yyreduce: #line 359 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, 0), (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2051,7 +2051,7 @@ yyreduce: #line 370 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, (yyvsp[(2) - (4)].node), (yyvsp[(4) - (4)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2067,7 +2067,7 @@ yyreduce: #line 383 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeReturnAql(context, (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2208,7 +2208,7 @@ yyreduce: } node = TRI_CreateNodeListAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2223,7 +2223,7 @@ yyreduce: { TRI_aql_node_t* list = TRI_PopStackParseAql(context); TRI_aql_node_t* node = TRI_CreateNodeFcallAql(context, TRI_PopStackParseAql(context), list); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2237,7 +2237,7 @@ yyreduce: #line 489 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryPlusAql(context, (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2251,7 +2251,7 @@ yyreduce: #line 497 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryMinusAql(context, (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2265,7 +2265,7 @@ yyreduce: #line 505 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryNotAql(context, (yyvsp[(2) - (2)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2279,7 +2279,7 @@ yyreduce: #line 516 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryOrAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2293,7 +2293,7 @@ yyreduce: #line 524 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryAndAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2307,7 +2307,7 @@ yyreduce: #line 532 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryPlusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2321,7 +2321,7 @@ yyreduce: #line 540 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryMinusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2335,7 +2335,7 @@ yyreduce: #line 548 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryTimesAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2349,7 +2349,7 @@ yyreduce: #line 556 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryDivAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2363,7 +2363,7 @@ yyreduce: #line 564 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryModAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2377,7 +2377,7 @@ yyreduce: #line 572 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryEqAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2391,7 +2391,7 @@ yyreduce: #line 580 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryNeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2405,7 +2405,7 @@ yyreduce: #line 588 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2419,7 +2419,7 @@ yyreduce: #line 596 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2433,7 +2433,7 @@ yyreduce: #line 604 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2447,7 +2447,7 @@ yyreduce: #line 612 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2461,7 +2461,7 @@ yyreduce: #line 620 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryInAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2475,7 +2475,7 @@ yyreduce: #line 631 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeOperatorTernaryAql(context, (yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2541,7 +2541,7 @@ yyreduce: #line 667 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeListAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2602,7 +2602,7 @@ yyreduce: #line 700 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeArrayAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2694,7 +2694,7 @@ yyreduce: // create a temporary variable for the row iterator (will be popped by "expansion" rule") node = TRI_CreateNodeReferenceAql(context, varname); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2750,7 +2750,7 @@ yyreduce: node = TRI_CreateNodeCollectionAql(context, (yyvsp[(1) - (1)].strval)); } - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2881,7 +2881,7 @@ yyreduce: #line 881 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, (yyvsp[(1) - (1)].strval)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2917,7 +2917,7 @@ yyreduce: } node = TRI_CreateNodeValueDoubleAql(context, value); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2931,7 +2931,7 @@ yyreduce: #line 913 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2945,7 +2945,7 @@ yyreduce: #line 921 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2959,7 +2959,7 @@ yyreduce: #line 929 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -2973,7 +2973,7 @@ yyreduce: #line 940 "arangod/Ahuacatl/ahuacatl-grammar.y" { TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, (yyvsp[(1) - (1)].strval)); - if (! node) { + if (node == NULL) { ABORT_OOM } @@ -3031,7 +3031,7 @@ yyreduce: } node = TRI_CreateNodeValueIntAql(context, value); - if (! node) { + if (node == NULL) { ABORT_OOM } diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 4e3b549dd3..86ca793895 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -308,7 +308,6 @@ static bool ParseDocumentHandle (v8::Handle arg, } // string handle - TRI_Utf8ValueNFC str(TRI_UNKNOWN_MEM_ZONE, arg); char const* s = *str; @@ -316,7 +315,6 @@ static bool ParseDocumentHandle (v8::Handle arg, return false; } - TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); regmatch_t matches[3]; @@ -336,6 +334,37 @@ static bool ParseDocumentHandle (v8::Handle arg, return false; } +//////////////////////////////////////////////////////////////////////////////// +/// @brief extracts a document key from a document +//////////////////////////////////////////////////////////////////////////////// + +static int ExtractDocumentKey (v8::Handle arg, + TRI_voc_key_t& key) { + TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); + + if (arg->IsObject()) { + v8::Handle obj = arg->ToObject(); + + if (obj->Has(v8g->KeyKey)) { + v8::Handle v = obj->Get(v8g->KeyKey); + + if (v->IsString()) { + // string key + TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v); + key = TRI_DuplicateString2(*str, str.length()); + } + else { + return TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD; + } + } + } + else { + return TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING; + } + + return TRI_ERROR_NO_ERROR; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief checks if argument is an index identifier //////////////////////////////////////////////////////////////////////////////// @@ -436,11 +465,11 @@ static v8::Handle IndexRep (TRI_collection_t* col, TRI_json_t* idx) { /// @brief converts argument strings to TRI_vector_pointer_t //////////////////////////////////////////////////////////////////////////////// -int AttributeNamesFromArguments (v8::Arguments const& argv, - TRI_vector_pointer_t* result, - size_t start, - size_t end, - string& error) { +static int AttributeNamesFromArguments (v8::Arguments const& argv, + TRI_vector_pointer_t* result, + size_t start, + size_t end, + string& error) { // ........................................................................... // convert the arguments into a "C" string and stuff them into a vector @@ -954,13 +983,21 @@ static v8::Handle ReplaceVocbaseCol (const bool useCollection, /// @brief saves a document //////////////////////////////////////////////////////////////////////////////// -static v8::Handle SaveVocbaseCol (SingleCollectionWriteTransaction, 1>* trx, - TRI_vocbase_col_t* col, - v8::Arguments const& argv) { +static v8::Handle SaveVocbaseCol ( + SingleCollectionWriteTransaction, 1>* trx, + TRI_vocbase_col_t* col, + v8::Arguments const& argv, + bool replace, + bool lock) { v8::HandleScope scope; - if (argv.Length() < 1 || argv.Length() > 2) { - TRI_V8_EXCEPTION_USAGE(scope, "save(, )"); + if (argv.Length() < 2 || argv.Length() > 3) { + if (replace) { + TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, )"); + } + else { + TRI_V8_EXCEPTION_USAGE(scope, "save(, )"); + } } CollectionNameResolver resolver(col->_vocbase); @@ -969,20 +1006,16 @@ static v8::Handle SaveVocbaseCol (SingleCollectionWriteTransactionGetData(); + int res; if (argv[0]->IsObject()) { - v8::Handle obj = argv[0]->ToObject(); - if (obj->Has(v8g->KeyKey)) { - v8::Handle v = obj->Get(v8g->KeyKey); - if (v->IsString()) { - // string key - TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v); - key = TRI_DuplicateString2(*str, str.length()); - holder.registerString(TRI_CORE_MEM_ZONE, key); - } - else { - TRI_V8_EXCEPTION(scope, TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD); - } + res = ExtractDocumentKey(argv[0]->ToObject(), key); + + if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) { + TRI_V8_EXCEPTION(scope, res); + } + else if (key != 0) { + holder.registerString(TRI_CORE_MEM_ZONE, key); } } @@ -996,7 +1029,7 @@ static v8::Handle SaveVocbaseCol (SingleCollectionWriteTransactioncreateDocument(key, &document, shaped, forceSync, true); + res = trx->createDocument(key, &document, shaped, forceSync, lock); res = trx->finish(res); @@ -1016,38 +1049,24 @@ static v8::Handle SaveVocbaseCol (SingleCollectionWriteTransaction SaveEdgeCol (SingleCollectionWriteTransaction, 1>* trx, - TRI_vocbase_col_t* col, - v8::Arguments const& argv) { +static v8::Handle SaveEdgeCol ( + SingleCollectionWriteTransaction, 1>* trx, + TRI_vocbase_col_t* col, + v8::Arguments const& argv, + bool replace, + bool lock) { v8::HandleScope scope; TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); if (argv.Length() < 3 || argv.Length() > 4) { - TRI_V8_EXCEPTION_USAGE(scope, "save(, , , )"); + if (replace) { + TRI_V8_EXCEPTION_USAGE(scope, "save(, , , )"); + } + else { + TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, , , )"); + } } CollectionNameResolver resolver(col->_vocbase); @@ -1055,19 +1074,16 @@ static v8::Handle SaveEdgeCol (SingleCollectionWriteTransactionIsObject()) { - v8::Handle obj = argv[2]->ToObject(); - if (obj->Has(v8g->KeyKey)) { - v8::Handle v = obj->Get(v8g->KeyKey); - if (v->IsString()) { - TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v); - key = TRI_DuplicateString2(*str, str.length()); - holder.registerString(TRI_CORE_MEM_ZONE, key); - } - else { - TRI_V8_EXCEPTION(scope, TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD); - } + res = ExtractDocumentKey(argv[2]->ToObject(), key); + + if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) { + TRI_V8_EXCEPTION(scope, res); + } + else if (key != 0) { + holder.registerString(TRI_CORE_MEM_ZONE, key); } } @@ -1119,7 +1135,7 @@ static v8::Handle SaveEdgeCol (SingleCollectionWriteTransactioncreateEdge(key, &document, shaped, forceSync, &edge, true); + res = trx->createEdge(key, &document, shaped, forceSync, &edge, lock); res = trx->finish(res); if (res != TRI_ERROR_NO_ERROR) { @@ -4974,7 +4990,6 @@ static v8::Handle JS_UpdateVocbaseCol (v8::Arguments const& argv) { /// @verbinclude shell_create-document //////////////////////////////////////////////////////////////////////////////// - static v8::Handle JS_SaveVocbaseCol (v8::Arguments const& argv) { v8::HandleScope scope; @@ -4996,10 +5011,151 @@ static v8::Handle JS_SaveVocbaseCol (v8::Arguments const& argv) { v8::Handle result; if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) { - result = SaveVocbaseCol(&trx, col, argv); + result = SaveVocbaseCol(&trx, col, argv, false, true); } else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) { - result = SaveEdgeCol(&trx, col, argv); + result = SaveEdgeCol(&trx, col, argv, false, true); + } + + return scope.Close(result); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @fn SaveEdgeCol +/// @brief saves a new edge document +/// +/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document})} +/// +/// Saves a new edge and returns the document-handle. @FA{from} and @FA{to} +/// must be documents or document references. +/// +/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document}, @FA{waitForSync})} +/// +/// The optional @FA{waitForSync} parameter can be used to force +/// synchronisation of the document creation operation to disk even in case +/// that the @LIT{waitForSync} flag had been disabled for the entire collection. +/// Thus, the @FA{waitForSync} parameter can be used to force synchronisation +/// of just specific operations. To use this, set the @FA{waitForSync} parameter +/// to @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to +/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is +/// applied. The @FA{waitForSync} parameter cannot be used to disable +/// synchronisation for collections that have a default @LIT{waitForSync} value +/// of @LIT{true}. +/// +/// @EXAMPLES +/// +/// @TINYEXAMPLE{shell_create-edge,create an edge} +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief saves or replaces a document +/// +/// @FUN{@FA{collection}.saveOrReplace(@FA{data})} +/// +/// Creates a new document with in the @FA{collection} from the given @FA{data} +/// or replaces an existing document. The @FA{data} must be a hash array. It +/// must not contain attributes starting with `_`, expect the document key +/// stored in `_key`. If there already exists a document with the given key it +/// is replaced. +/// +/// The method returns a document with the attributes `_key`, `_id` and `_rev`. +/// The attribute `_id` contains the document handle of the newly created or +/// replaced document; the attribute `_key` contains the document key; the +/// attribute `_rev` contains the document revision. +/// +/// @FUN{@FA{collection}.saveOrReplace(@FA{data}, @FA{waitForSync})} +/// +/// The optional @FA{waitForSync} parameter can be used to force synchronisation +/// of the document creation operation to disk even in case that the +/// `waitForSync` flag had been disabled for the entire collection. Thus, the +/// `waitForSync` parameter can be used to force synchronisation of just +/// specific operations. To use this, set the `waitForSync` parameter to +/// `true`. If the `waitForSync` parameter is not specified or set to `false`, +/// then the collection's default `waitForSync` behavior is applied. The +/// `waitForSync` parameter cannot be used to disable synchronisation for +/// collections that have a default `waitForSync` value of `true`. +/// +/// @EXAMPLES +/// +/// @EXAMPLE_ARANGOSH_OUTPUT{ShellSaveOrReplace1} +/// doc = db.saveOrReplace("aardvark", { german: "Erdferkell" }); +/// doc = db.saveOrReplace("aardvark", { german: "Erdferkel" }); +/// @END_EXAMPLE_ARANGOSH_OUTPUT +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle JS_SaveOrReplaceVocbaseCol (v8::Arguments const& argv) { + v8::HandleScope scope; + + TRI_vocbase_col_t* col = TRI_UnwrapClass(argv.Holder(), WRP_VOCBASE_COL_TYPE); + + if (col == 0) { + TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract collection"); + } + + size_t pos; + + if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) { + if (argv.length < 1) { + TRI_V8_EXCEPTION_USAGE("saveOrReplace(, "); + } + + pos = 0; + } + else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) { + if (argv.length < 1) { + TRI_V8_EXCEPTION_USAGE("saveOrReplace(, , , "); + } + + pos = 2; + } + else { + TRI_V8_EXCEPTION_INTERNAL(scope, "unknown collection type"); + } + + ResourceHolder holder; + + TRI_voc_key_t key; + int res = ExtractDocumentKey(argv[pos], key); + + if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) { + TRI_V8_EXCEPTION(scope, res); + } + else if (key != 0) { + holder.registerString(TRI_CORE_MEM_ZONE, key); + } + + CollectionNameResolver resolver(col->_vocbase); + SingleCollectionWriteTransaction, 1> trx(col->_vocbase, resolver, col->_cid); + + res = trx.begin(); + + if (res != TRI_ERROR_NO_ERROR) { + TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.begin failed"); + } + + res = trx.lockWrite(); + + if (res != TRI_ERROR_NO_ERROR) { + TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.lockWrite failed"); + } + + TRI_doc_mptr_t document; + res = trx.read(&document, key, false); + + v8::Handle result; + + if (res == TRI_ERROR_NO_ERROR) { + } + else if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) { + if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) { + result = SaveVocbaseCol(&trx, col, argv, true, false); + } + else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) { + result = SaveEdgeCol(&trx, col, argv, true, false); + } + } + else { + TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.read failed"); } return scope.Close(result); @@ -6589,6 +6745,7 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle context, TRI_AddMethodVocbase(rt, "replace", JS_ReplaceVocbaseCol); TRI_AddMethodVocbase(rt, "save", JS_SaveVocbaseCol); + TRI_AddMethodVocbase(rt, "saveOrReplace", JS_SaveOrReplaceVocbaseCol); TRI_AddMethodVocbase(rt, "update", JS_UpdateVocbaseCol); v8g->VocbaseColTempl = v8::Persistent::New(rt); diff --git a/html/admin/js/bootstrap/errors.js b/html/admin/js/bootstrap/errors.js index 61d4e36911..2f3e49a9ba 100644 --- a/html/admin/js/bootstrap/errors.js +++ b/html/admin/js/bootstrap/errors.js @@ -83,6 +83,7 @@ "ERROR_ARANGO_INDEX_NEEDS_RESIZE" : { "code" : 1223, "message" : "index needs resizing" }, "ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "database directory not writable" }, "ERROR_ARANGO_OUT_OF_KEYS" : { "code" : 1225, "message" : "out of keys" }, + "ERROR_ARANGO_DOCUMENT_KEY_MISSING" : { "code" : 1226, "message" : "missing document key" }, "ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" }, "ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" }, "ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" }, diff --git a/js/client/modules/org/arangodb/aal.js b/js/client/modules/org/arangodb/aal.js index 87727db251..487cdc23d2 100644 --- a/js/client/modules/org/arangodb/aal.js +++ b/js/client/modules/org/arangodb/aal.js @@ -38,7 +38,7 @@ var arangodb = require("org/arangodb"); var arangosh = require("org/arangodb/arangosh"); var arango = internal.arango; -var db = internal.db; +var db = arangodb.db; // ----------------------------------------------------------------------------- // --SECTION-- private functions @@ -57,6 +57,14 @@ function getStorage () { return db._collection('_aal'); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief returns the fishbow repository +//////////////////////////////////////////////////////////////////////////////// + +function getFishbowl (version) { + return "triAGENS/ArangoDB-Apps"; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief builds a github repository URL //////////////////////////////////////////////////////////////////////////////// @@ -74,7 +82,7 @@ function buildGithubUrl (repository, version) { //////////////////////////////////////////////////////////////////////////////// function buildGithubFishbowlUrl (name) { - return "https://raw.github.com/triAGENS/ArangoDB-Apps/master/Fishbowl/" + name + ".json"; + return "https://raw.github.com/" + getFishbowl() + "/master/Fishbowl/" + name + ".json"; } //////////////////////////////////////////////////////////////////////////////// @@ -318,6 +326,54 @@ function processSource (src) { return response.filename; } +//////////////////////////////////////////////////////////////////////////////// +/// @brief downloads the fishbowl repository +//////////////////////////////////////////////////////////////////////////////// + +function updateFishbowl () { + var i; + + var url = buildGithubUrl(getFishbowl()); + var filename = fs.getTempFile("downloads", false); + var path = fs.getTempFile("zip", false); + + try { + var result = internal.download(url, "get", filename); + + if (result.code < 200 || result.code > 299) { + throw "github download failed"; + } + + fs.unzipFile(filename, path, false, true); + fs.remove(filename); + + filename = undefined; + } + catch (err) { + if (filename !== undefined) { + fs.remove(filename); + } + + fs.removeDirectoryRecursive(path); + + throw new Error("could not download from repository '" + url + "':" + String(err)); + } + + var files = fs.list(fs.join(path, "ArangoDB-Apps-master/Fishbowl")); + + for (i = 0; i < files.length; ++i) { + var file = files[i]; + + if (/\.json$/.test(file)) { + console.log(file); + } + } + + fs.removeDirectoryRecursive(path); +} + +exports.updateFishbowl = updateFishbowl; + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/bootstrap/errors.js b/js/common/bootstrap/errors.js index 61d4e36911..2f3e49a9ba 100644 --- a/js/common/bootstrap/errors.js +++ b/js/common/bootstrap/errors.js @@ -83,6 +83,7 @@ "ERROR_ARANGO_INDEX_NEEDS_RESIZE" : { "code" : 1223, "message" : "index needs resizing" }, "ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "database directory not writable" }, "ERROR_ARANGO_OUT_OF_KEYS" : { "code" : 1225, "message" : "out of keys" }, + "ERROR_ARANGO_DOCUMENT_KEY_MISSING" : { "code" : 1226, "message" : "missing document key" }, "ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" }, "ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" }, "ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" }, diff --git a/js/server/modules/org/arangodb/foxx-manager.js b/js/server/modules/org/arangodb/foxx-manager.js index 3311ba7925..0d4d2d1feb 100644 --- a/js/server/modules/org/arangodb/foxx-manager.js +++ b/js/server/modules/org/arangodb/foxx-manager.js @@ -104,7 +104,7 @@ function buildAssetContent (app, assets) { try { var c = fs.read(files[i]); - content += c; + content += c + "\n"; } catch (err) { console.error("cannot read asset '%s'", files[i]); diff --git a/js/server/version-check.js b/js/server/version-check.js index c405bca73b..e5fc77c128 100644 --- a/js/server/version-check.js +++ b/js/server/version-check.js @@ -327,7 +327,7 @@ // set up the collection _aal addTask("setupAal", "setup _aal collection", function () { - return createSystemCollection("_aal", { waitForSync : false }); + return createSystemCollection("_aal", { waitForSync : true }); }); // create a unique index on collection attribute in _aal @@ -345,6 +345,26 @@ return true; }); + // set up the collection _aalFishbowl + addTask("setupAalFishbowl", "setup _aalFishbowl collection", function () { + return createSystemCollection("_aalFishbowl", { waitForSync : true }); + }); + + // create a unique index on collection attribute in _aal + addTask("createAalFisbowlIndex", + "create indexes on collection attribute in _aalFishbowl collection", + function () { + var aal = getCollection("_aal"); + + if (! aal) { + return false; + } + + aal.ensureUniqueConstraint("name"); + + return true; + }); + // loop through all tasks and execute them console.log("Found " + allTasks.length + " defined task(s), " + activeTasks.length + " task(s) to run"); diff --git a/lib/BasicsC/errors.dat b/lib/BasicsC/errors.dat index 3adce2b848..9fd364fa4a 100755 --- a/lib/BasicsC/errors.dat +++ b/lib/BasicsC/errors.dat @@ -101,6 +101,7 @@ ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED,1222,"unexpected document key","Will be rai ERROR_ARANGO_INDEX_NEEDS_RESIZE,1223,"index needs resizing","Will be raised when an index is full and should be resized to contain more data." ERROR_ARANGO_DATADIR_NOT_WRITABLE,1224,"database directory not writable","Will be raised when the database directory is not writable for the current user." ERROR_ARANGO_OUT_OF_KEYS,1225,"out of keys","Will be raised when a key generator runs out of keys." +ERROR_ARANGO_DOCUMENT_KEY_MISSING,1226,"missing document key","Will be raised when a document key is missing." ################################################################################ ## ArangoDB storage errors diff --git a/lib/BasicsC/voc-errors.c b/lib/BasicsC/voc-errors.c index be044f70ea..957c29c790 100644 --- a/lib/BasicsC/voc-errors.c +++ b/lib/BasicsC/voc-errors.c @@ -79,6 +79,7 @@ void TRI_InitialiseErrorMessages (void) { REG_ERROR(ERROR_ARANGO_INDEX_NEEDS_RESIZE, "index needs resizing"); REG_ERROR(ERROR_ARANGO_DATADIR_NOT_WRITABLE, "database directory not writable"); REG_ERROR(ERROR_ARANGO_OUT_OF_KEYS, "out of keys"); + REG_ERROR(ERROR_ARANGO_DOCUMENT_KEY_MISSING, "missing document key"); REG_ERROR(ERROR_ARANGO_DATAFILE_FULL, "datafile full"); REG_ERROR(ERROR_QUERY_KILLED, "query killed"); REG_ERROR(ERROR_QUERY_PARSE, "%s"); diff --git a/lib/BasicsC/voc-errors.h b/lib/BasicsC/voc-errors.h index de9209ea31..68400bf85b 100644 --- a/lib/BasicsC/voc-errors.h +++ b/lib/BasicsC/voc-errors.h @@ -162,6 +162,8 @@ extern "C" { /// current user. /// - 1225: @LIT{out of keys} /// Will be raised when a key generator runs out of keys. +/// - 1226: @LIT{missing document key} +/// Will be raised when a document key is missing. /// - 1300: @LIT{datafile full} /// Will be raised when the datafile reaches its limit. /// - 1500: @LIT{query killed} @@ -1089,6 +1091,16 @@ void TRI_InitialiseErrorMessages (void); #define TRI_ERROR_ARANGO_OUT_OF_KEYS (1225) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 1226: ERROR_ARANGO_DOCUMENT_KEY_MISSING +/// +/// missing document key +/// +/// Will be raised when a document key is missing. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING (1226) + //////////////////////////////////////////////////////////////////////////////// /// @brief 1300: ERROR_ARANGO_DATAFILE_FULL /// From 5b5e2b4daee654cc12f21e58e5059c55aa509d3a Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 11:19:24 +0200 Subject: [PATCH 03/14] removed DATABASEPATH (same as db._path) --- arangod/V8Server/v8-vocbase.cpp | 1 - js/server/bootstrap/module-internal.js | 9 +-------- js/server/version-check.js | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index d2607c555f..f055268260 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -6700,7 +6700,6 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle context, // create global variables // ............................................................................. - TRI_AddGlobalVariableVocbase(context, "DATABASEPATH", v8::String::New(vocbase->_path)); TRI_AddGlobalVariableVocbase(context, "db", TRI_WrapVocBase(vocbase)); // current thread number diff --git a/js/server/bootstrap/module-internal.js b/js/server/bootstrap/module-internal.js index e9e01fc271..869c77095e 100644 --- a/js/server/bootstrap/module-internal.js +++ b/js/server/bootstrap/module-internal.js @@ -1,7 +1,7 @@ /*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true, white: true, plusplus: true, nonpropdel: true */ /*global require, db, ArangoCollection, ArangoDatabase, ArangoError, ArangoCursor, ShapedJson, RELOAD_AUTH, SYS_DEFINE_ACTION, SYS_EXECUTE_GLOBAL_CONTEXT_FUNCTION, - DATABASEPATH, AHUACATL_RUN, AHUACATL_PARSE, AHUACATL_EXPLAIN */ + AHUACATL_RUN, AHUACATL_PARSE, AHUACATL_EXPLAIN */ //////////////////////////////////////////////////////////////////////////////// /// @brief module "internal" @@ -78,13 +78,6 @@ /// @{ //////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -/// @brief database path -//////////////////////////////////////////////////////////////////////////////// - - internal.DATABASEPATH = DATABASEPATH; - delete DATABASEPATH; - //////////////////////////////////////////////////////////////////////////////// /// @brief execute an AQL query //////////////////////////////////////////////////////////////////////////////// diff --git a/js/server/version-check.js b/js/server/version-check.js index 035da9b951..12ac7cf8f2 100644 --- a/js/server/version-check.js +++ b/js/server/version-check.js @@ -50,7 +50,7 @@ var db = internal.db; // path to the VERSION file - var versionFile = internal.DATABASEPATH + "/VERSION"; + var versionFile = internal.db._path + "/VERSION"; function runUpgrade (currentVersion) { var allTasks = [ ]; From 0600cc852e3c60ae52aa85814cc72e1723c119df Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 21:57:58 +0200 Subject: [PATCH 04/14] fixed mem error --- lib/V8/v8-json.cpp | 16 ++++++++++------ lib/V8/v8-json.ll | 14 +++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/V8/v8-json.cpp b/lib/V8/v8-json.cpp index 218408ff22..3dde037d4b 100644 --- a/lib/V8/v8-json.cpp +++ b/lib/V8/v8-json.cpp @@ -26,7 +26,7 @@ /// @author Copyright 2011, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -#include +#include "BasicsC/common.h" #include "V8/v8-globals.h" @@ -2249,15 +2249,18 @@ static v8::Handle ParseObject (yyscan_t scanner, int c) { else { // string is not empty ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength); - } - if (ptr == NULL) { - yyextra._message = "out-of-memory"; - return scope.Close(v8::Undefined()); + if (ptr == NULL || outLength == 0) { + yyextra._message = "out-of-memory"; + return scope.Close(v8::Undefined()); + } } str = v8::String::New(ptr, outLength); - TRI_FreeString(yyextra._memoryZone, ptr); + + if (0 < outLength) { + TRI_FreeString(yyextra._memoryZone, ptr); + } return scope.Close(str); @@ -2321,6 +2324,7 @@ v8::Handle TRI_FromJsonString (char const* text, char** error) { tri_v8_lex_init(&scanner); yyg = (struct yyguts_t*) scanner; + yyextra._memoryZone = TRI_CORE_MEM_ZONE; buf = tri_v8__scan_string(text,scanner); c = tri_v8_lex(scanner); diff --git a/lib/V8/v8-json.ll b/lib/V8/v8-json.ll index b7b8a34ba5..b154980e0b 100644 --- a/lib/V8/v8-json.ll +++ b/lib/V8/v8-json.ll @@ -360,15 +360,18 @@ static v8::Handle ParseObject (yyscan_t scanner, int c) { else { // string is not empty ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength); - } - if (ptr == NULL) { - yyextra._message = "out-of-memory"; - return scope.Close(v8::Undefined()); + if (ptr == NULL || outLength == 0) { + yyextra._message = "out-of-memory"; + return scope.Close(v8::Undefined()); + } } str = v8::String::New(ptr, outLength); - TRI_FreeString(yyextra._memoryZone, ptr); + + if (0 < outLength) { + TRI_FreeString(yyextra._memoryZone, ptr); + } return scope.Close(str); @@ -432,6 +435,7 @@ v8::Handle TRI_FromJsonString (char const* text, char** error) { yylex_init(&scanner); yyg = (struct yyguts_t*) scanner; + yyextra._memoryZone = TRI_CORE_MEM_ZONE; buf = yy_scan_string(text, scanner); c = yylex(scanner); From 6c8ec64daebce84fbada09551fb623028683241e Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 22:00:50 +0200 Subject: [PATCH 05/14] comment out unfinished stuff --- arangod/V8Server/v8-vocbase.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 64986c8887..accc2b8a06 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -5139,6 +5139,7 @@ static v8::Handle JS_SaveVocbaseCol (v8::Arguments const& argv) { /// @END_EXAMPLE_ARANGOSH_OUTPUT //////////////////////////////////////////////////////////////////////////////// +#if 0 static v8::Handle JS_SaveOrReplaceVocbaseCol (v8::Arguments const& argv) { v8::HandleScope scope; @@ -5216,6 +5217,7 @@ static v8::Handle JS_SaveOrReplaceVocbaseCol (v8::Arguments const& ar return scope.Close(result); } +#endif //////////////////////////////////////////////////////////////////////////////// /// @brief sets a parameter attribute of a collection @@ -6803,7 +6805,9 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle context, TRI_AddMethodVocbase(rt, "replace", JS_ReplaceVocbaseCol); TRI_AddMethodVocbase(rt, "save", JS_SaveVocbaseCol); +#if 0 TRI_AddMethodVocbase(rt, "saveOrReplace", JS_SaveOrReplaceVocbaseCol); +#endif TRI_AddMethodVocbase(rt, "update", JS_UpdateVocbaseCol); v8g->VocbaseColTempl = v8::Persistent::New(rt); From e1dbf6ab929fa356d4683a51b24f3655d8dd7c2b Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 22:11:44 +0200 Subject: [PATCH 06/14] fixed path --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3c56c89b41..0116d75a6c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -235,7 +235,7 @@ nobase_pkgdata_DATA = \ if ENABLE_MRUBY nobase_pkgdata_DATA += \ - $(shell find @srcdir@/mr/actions/system -name "*.rb" -print) + $(shell find @srcdir@/mr/actions -name "*.rb" -print) endif From 781839294dd2e8a7fc8ed690b49c69aac56a4554 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 22:22:59 +0200 Subject: [PATCH 07/14] use official maintainer-mode --- m4/configure.maintainer | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/m4/configure.maintainer b/m4/configure.maintainer index a2c05f7c2f..0bf3a08dc3 100644 --- a/m4/configure.maintainer +++ b/m4/configure.maintainer @@ -4,23 +4,19 @@ dnl ---------------------------------------------------------------------------- dnl --SECTION-- MAINTAINER MODE dnl ---------------------------------------------------------------------------- -AC_ARG_ENABLE(maintainer-mode, - AS_HELP_STRING([--enable-maintainer-mode], [enable maintainer mode (default: no)]), - [tr_MAINTAINER_MODE="${enableval:-yes}"], - [tr_MAINTAINER_MODE=no] -) +AM_MAINTAINER_MODE -if test "x$tr_MAINTAINER_MODE" = "xyes"; then +if test "x$USE_MAINTAINER_MODE" = "xyes"; then AC_DEFINE_UNQUOTED(TRI_ENABLE_MAINTAINER_MODE, 1, [true if maintainer mode is enabled]) fi -AM_CONDITIONAL(ENABLE_MAINTAINER_MODE, test "x$tr_MAINTAINER_MODE" = xyes) +AM_CONDITIONAL(ENABLE_MAINTAINER_MODE, test "x$USE_MAINTAINER_MODE" = xyes) dnl ---------------------------------------------------------------------------- dnl check for bison dnl ---------------------------------------------------------------------------- -if test "x$tr_MAINTAINER_MODE" = xyes; then +if test "x$USE_MAINTAINER_MODE" = xyes; then AC_MSG_NOTICE([................................................................................]) AC_MSG_NOTICE([CHECKING BISON]) AC_MSG_NOTICE([................................................................................]) @@ -58,7 +54,7 @@ dnl ---------------------------------------------------------------------------- dnl check for flex dnl ---------------------------------------------------------------------------- -if test "x$tr_MAINTAINER_MODE" = xyes; then +if test "x$USE_MAINTAINER_MODE" = xyes; then AC_MSG_NOTICE([................................................................................]) AC_MSG_NOTICE([CHECKING FLEX]) AC_MSG_NOTICE([................................................................................]) From 38a2ff49c2bfc664990750aa7fcab9d9128514e8 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 23:05:03 +0200 Subject: [PATCH 08/14] fixed wrong length check --- arangod/V8Server/v8-vocbase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index accc2b8a06..f4e68abcaf 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -1022,12 +1022,12 @@ static v8::Handle SaveVocbaseCol ( bool lock) { v8::HandleScope scope; - if (argv.Length() < 2 || argv.Length() > 3) { + if (argv.Length() < 1 || argv.Length() > 2) { if (replace) { - TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, )"); + TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, [])"); } else { - TRI_V8_EXCEPTION_USAGE(scope, "save(, )"); + TRI_V8_EXCEPTION_USAGE(scope, "save(, [])"); } } From 7135714207f6c491b6afded05da7690bdc40bdf3 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 23:18:05 +0200 Subject: [PATCH 09/14] removed the static options --- configure.ac | 1 - m4/all-in-one.mruby | 2 +- m4/configure.basics | 197 ------------------------------------------- m4/configure.static | 63 -------------- m4/external.icu | 2 - m4/external.libev | 12 +-- m4/external.openssl | 34 -------- m4/external.readline | 9 +- m4/external.v8 | 2 - 9 files changed, 6 insertions(+), 316 deletions(-) delete mode 100644 m4/configure.static diff --git a/configure.ac b/configure.ac index 83d26cb36d..5d68a78a22 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,6 @@ dnl ============================================================================ m4_include([m4/configure.basics]) AC_PROG_RANLIB -m4_include([m4/configure.static]) m4_include([m4/configure.logging]) m4_include([m4/configure.largefile]) m4_include([m4/configure.threads]) diff --git a/m4/all-in-one.mruby b/m4/all-in-one.mruby index 5026dd57cf..fcf7cdcf41 100644 --- a/m4/all-in-one.mruby +++ b/m4/all-in-one.mruby @@ -9,7 +9,7 @@ MRUBY_LDLAGS="" MRUBY_LIBSLAGS="" AC_ARG_ENABLE(mruby, - AS_HELP_STRING([--enable-mruby], [enable MRUBY]), + AS_HELP_STRING([--enable-mruby], [enable MRUBY (default: no)]), [tr_MRUBY="${enableval:-yes}"], [tr_MRUBY=no] ) diff --git a/m4/configure.basics b/m4/configure.basics index be22d036c6..ee3b896ddb 100644 --- a/m4/configure.basics +++ b/m4/configure.basics @@ -196,26 +196,6 @@ if test "x$tr_ISYSTEM" = "xno"; then INCPREFIX="-I" fi -dnl ---------------------------------------------------------------------------- -dnl checks for linker settings -dnl ---------------------------------------------------------------------------- - -case $target in - *-apple-darwin*) - ABS_STATIC_LIBS="yes" - STATIC_LIBS="" - DYNAMIC_LIBS="" - LIBTOOL_LIBS="" - USE_DYLD="yes" - ;; - - *) - STATIC_LIBS="-Wl,-Bstatic" - DYNAMIC_LIBS="-Wl,-Bdynamic" - LIBTOOL_LIBS="-Wl," - ;; -esac - dnl ---------------------------------------------------------------------------- dnl generate correct include, either -I oder -isystem dnl ---------------------------------------------------------------------------- @@ -250,180 +230,3 @@ AC_DEFUN([TR_LIBRARY],[ esac done ]) - -dnl ---------------------------------------------------------------------------- -dnl static enable library -dnl -dnl usage: TR_STATIC_ENABLE(static-if-name) -dnl ---------------------------------------------------------------------------- - -AC_DEFUN([TR_STATIC_ENABLE],[ - if test "x$STATIC_LIBS" != x -o "x$ABS_STATIC_LIBS" = xyes; then - AC_ARG_ENABLE(static-$1, - AS_HELP_STRING([--enable-static-$1], [using static library '$1' (default: no)]), - [tr_static_$1="$enableval"], - [tr_static_$1="no"] - ) - else - tr_static_$1="no" - fi -]) - -dnl ---------------------------------------------------------------------------- -dnl find static or shared C library -dnl -dnl usage: TR_FIND_C_LIBRARY(static-if-name, -dnl library, -dnl lib environment, -dnl function to check) -dnl -dnl returns: tr_library_found -dnl ---------------------------------------------------------------------------- - -AC_DEFUN([TR_FIND_C_LIBRARY],[ - if test "x$ABS_STATIC_LIBS" = xyes -a "x$tr_static_$1" = xyes; then - tr_library_found=no - - AC_MSG_CHECKING([$2]) - TR_LIBRARY($2) - - if test "x$tr_library" != x; then - $3="$tr_library $$3" - AC_MSG_RESULT([$tr_library]) - tr_library_found=yes - else - AC_MSG_RESULT([no]) - fi - else - tr_library_found=yes - - AC_CHECK_LIB([$2], - [$4], - [$3="-l$2 $$3"], - [tr_library_found=no]) - fi -]) - -dnl ---------------------------------------------------------------------------- -dnl find static or shared C++ library -dnl -dnl usage: TR_FIND_CXX_LIBRARY(static-if-name, -dnl library, -dnl lib environment, -dnl include header, -dnl body source code) -dnl -dnl returns: tr_library_found -dnl ---------------------------------------------------------------------------- - -AC_DEFUN([TR_FIND_CXX_LIBRARY],[ - if test "x$ABS_STATIC_LIBS" = xyes -a "x$tr_static_$1" = xyes; then - tr_library_found=no - - AC_MSG_CHECKING([$2]) - TR_LIBRARY($2) - - if test "x$tr_library" != x; then - $3="$tr_library $$3" - AC_MSG_RESULT([$tr_library]) - tr_library_found=yes - else - AC_MSG_RESULT([no]) - fi - else - tr_library_found=yes - - AX_CXX_CHECK_LIB([$2], - [$4], - [$5], - [$3="-l$2 $$3"], - [tr_library_found=no]) - fi -]) - -dnl ---------------------------------------------------------------------------- -dnl find absolute path for libraries -dnl -dnl usage: TR_ABSOLUTE_LIBRARIES(lib environment) -dnl -dnl returns: tr_libraries_found -dnl ---------------------------------------------------------------------------- - -AC_DEFUN([TR_ABSOLUTE_LIBRARIES], - [if test "x$tr_static_$1" = xyes -a "x$ABS_STATIC_LIBS" = xyes; then - tr_libraries_found=no - tr_missing="" - tr_result="" - tr_special="" - - for tr_lib in $$2; do - case $tr_lib in - -lpthread|-lm|-lrt) - tr_special="$tr_special $tr_lib" - ;; - - -l*) - lib=`echo $tr_lib | sed -e 's:^-l::'` - tr_missing="$tr_missing $lib" - ;; - esac - done - - for tr_path in $$2; do - case $tr_path in - -L*) - path=`echo $tr_path | sed -e 's:^-L::'` - - tr_still_missing="" - - for tr_lib in $tr_missing; do - AC_MSG_CHECKING([for the static library $tr_lib in $path]) - - if test -f "$path/lib$tr_lib.a"; then - AC_MSG_RESULT([$path/lib$tr_lib.a]) - tr_result="$tr_result $path/lib$tr_lib.a" - else - AC_MSG_RESULT() - tr_still_missing="$tr_sill_missing $tr_lib" - fi - done - - tr_missing="$tr_still_missing" - ;; - esac - done - - for tr_path in $LDFLAGS; do - case $tr_path in - -L*) - path=`echo $tr_path | sed -e 's:^-L::'` - - tr_still_missing="" - - for tr_lib in $tr_missing; do - AC_MSG_CHECKING([for the static library $tr_lib in $path]) - - if test -f "$path/lib$tr_lib.a"; then - AC_MSG_RESULT([$path/lib$tr_lib.a]) - tr_result="$tr_result $path/lib$tr_lib.a" - else - AC_MSG_RESULT() - tr_still_missing="$tr_sill_missing $tr_lib" - fi - done - - tr_missing="$tr_still_missing" - ;; - esac - done - - if test "x$tr_missing" = x; then - tr_libraries_found=yes - $2="$tr_result $tr_special" - else - tr_libraries_found=no - fi - else - tr_libraries_found=yes - fi -]) diff --git a/m4/configure.static b/m4/configure.static deleted file mode 100644 index 532fd0ee39..0000000000 --- a/m4/configure.static +++ /dev/null @@ -1,63 +0,0 @@ -dnl -*- mode: Autoconf; -*- - -dnl ----------------------------------------------------------------------------------------- -dnl option for static programs -dnl -dnl Note that you need static system libraries -dnl ----------------------------------------------------------------------------------------- - -AC_ARG_ENABLE(static-programs, - AS_HELP_STRING([--enable-static-programs], [do not use shared libraries (default: no)]), - tr_STATIC_PROGRAMS="$enableval", - tr_STATIC_PROGRAMS="no" -) - -dnl ----------------------------------------------------------------------------------------- -dnl enable static programs if possible -dnl ----------------------------------------------------------------------------------------- - -if test "x$tr_STATIC_PROGRAMS" = xyes; then - LDFLAGS="$LDFLAGS -static" -fi - -dnl ----------------------------------------------------------------------------------------- -dnl static library -dnl -dnl usage: TR_STATIC_LIBRARY(static-if-name, -dnl library environment) -dnl ----------------------------------------------------------------------------------------- - -AC_DEFUN([TR_STATIC_LIBRARY],[ - if test "x$tr_static_$1" = xyes -a "x$2" != x; then - tr_libs="" - tr_special="" - - for tr_lib in $$2; do - case $tr_lib in - -lpthread|-lm|-lrt) - tr_special="$tr_special $tr_lib" - ;; - - -l*) - tr_libs="$tr_libs $tr_lib" - ;; - - *) - tr_libs="$tr_libs $tr_lib" - ;; - esac - done - - $2="$STATIC_LIBS $tr_libs $DYNAMIC_LIBS $tr_special" - fi -]) - -dnl ----------------------------------------------------------------------------------------- -dnl informational output -dnl ----------------------------------------------------------------------------------------- - -if test "x$tr_STATIC_PROGRAMS" = xyes; then - BASIC_INFO="$BASIC_INFO|STATIC PROGRAMS: enabled" -else - BASIC_INFO="$BASIC_INFO|STATIC PROGRAMS: disabled" -fi diff --git a/m4/external.icu b/m4/external.icu index e072a41128..c6df18554e 100644 --- a/m4/external.icu +++ b/m4/external.icu @@ -13,8 +13,6 @@ AC_ARG_WITH(icu-config, [ICU_CONFIG="$withval"] ) -dnl TR_STATIC_ENABLE([ICU]) - if test "x$tr_ICU" = xyes; then AC_MSG_NOTICE([--------------------------------------------------------------------------------]) AC_MSG_NOTICE([CHECKING FOR ICU]) diff --git a/m4/external.libev b/m4/external.libev index 92a0059988..8eb279e8da 100644 --- a/m4/external.libev +++ b/m4/external.libev @@ -16,8 +16,6 @@ AC_ARG_WITH(libev-lib, [LIBEV_LDFLAGS="-L$withval"] ) -TR_STATIC_ENABLE([libev]) - AC_MSG_NOTICE([--------------------------------------------------------------------------------]) AC_MSG_NOTICE([CHECKING FOR LIBEV]) AC_MSG_NOTICE([--------------------------------------------------------------------------------]) @@ -55,15 +53,11 @@ ch_LIBEV="$tr_LIBEV" AC_CHECK_HEADERS(ev.h, [tr_LIBEV="yes"], [tr_LIBEV="no"]) if test "x$tr_LIBEV" = xyes; then - AC_CHECK_LIB([rt], [clock_gettime], [LIBEV_LIBS="-lrt $LIBEV_LIBS" LIBS="-lrt $LIBS"], ) - - TR_FIND_C_LIBRARY([libev], [ev], [LIBEV_LIBS], [ev_now]) - tr_LIBEV=$tr_library_found + AC_CHECK_LIB([rt], [clock_gettime], [LIBEV_LIBS="-lrt" LIBS="-lrt $LIBS"], ) + AC_CHECK_LIB([libev], [ev_now], [LIBEV_LIBS="-lev $LIBEV_LIBS" tr_LIBEV="yes"], ) fi -if test "x$tr_LIBEV" = xyes; then - TR_STATIC_LIBRARY([libev], [LIBEV_LIBS]) -else +if test "x$tr_LIBEV" != xyes; then AC_MSG_ERROR([Please install libev from http://software.schmorp.de/pkg/libev.html]) fi diff --git a/m4/external.openssl b/m4/external.openssl index d472b711d4..4085b59f6f 100644 --- a/m4/external.openssl +++ b/m4/external.openssl @@ -14,8 +14,6 @@ AC_ARG_WITH(openssl-lib, OPENSSL_LDFLAGS="-L$withval" ) -TR_STATIC_ENABLE([ssl]) - dnl ----------------------------------------------------------------------------------------- dnl check for OpenSSL dnl ----------------------------------------------------------------------------------------- @@ -72,43 +70,11 @@ else AC_MSG_RESULT([SSL_METHOD*]) fi -dnl check if openssl was compiled using zlib -if test "x$tr_STATIC_PROGRAMS" = xyes; then - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - - AC_MSG_CHECKING([if OpenSSL requires static zlib]) - - AC_LINK_IFELSE([AC_LANG_PROGRAM( - [[ -#include - ]], - [[ - SSL_library_init(); - ]])], - [tr_OPENSSL_NEEDS_ZLIB=no], - [tr_OPENSSL_NEEDS_ZLIB=yes]) - - AC_MSG_RESULT($tr_OPENSSL_NEEDS_ZLIB) - - if test "x$tr_OPENSSL_NEEDS_ZLIB" = "xyes"; then - AC_CHECK_LIB([z], [zError], - OPENSSL_LIBS="$OPENSSL_LIBS -lz", - AC_MSG_ERROR([please install the static zlib library])) - fi -fi - -TR_ABSOLUTE_LIBRARIES([ssl], [OPENSSL_LIBS]) - -if test "x$tr_libraries_found" != xyes; then - AC_MSG_ERROR([Please install the OpenSSL library]) -fi - dnl ----------------------------------------------------------------------------------------- dnl fix include and static libraries dnl ----------------------------------------------------------------------------------------- TR_INCLUDE([OPENSSL_CPPFLAGS]) -TR_STATIC_LIBRARY([ssl], [OPENSSL_LIBS]) dnl ----------------------------------------------------------------------------------------- dnl add substitutions diff --git a/m4/external.readline b/m4/external.readline index 2376653935..cd47b6d172 100644 --- a/m4/external.readline +++ b/m4/external.readline @@ -28,8 +28,6 @@ AC_ARG_WITH(readline-lib, [READLINE_LDFLAGS="-L$withval"] ) -TR_STATIC_ENABLE([readline]) - dnl ---------------------------------------------------------------------------- dnl checks for the READLINE library dnl ---------------------------------------------------------------------------- @@ -60,13 +58,10 @@ if test "x$tr_READLINE" = xyes -o "x$tr_READLINE" = xmaybe; then AC_CHECK_HEADERS(readline/readline.h, [tr_READLINE="yes"], [tr_READLINE="no"]) if test "x$tr_READLINE" = xyes; then - TR_FIND_C_LIBRARY([readline], [readline], [READLINE_LIBS], [readline]) - tr_READLINE=$tr_library_found + AC_CHECK_LIB([readline], [readline], [READLINE_LIBS="-lreadline" tr_READLINE="yes"], [tr_READLINE="no"]) fi - if test "x$tr_READLINE" = xyes; then - TR_STATIC_LIBRARY([readline], [READLINE_LIBS]) - else + if test "x$tr_READLINE" != xyes; then if test "x$ch_READLINE" = xyes; then AC_MSG_ERROR([Please install readline support]) fi diff --git a/m4/external.v8 b/m4/external.v8 index 4b4515cac5..2323773539 100644 --- a/m4/external.v8 +++ b/m4/external.v8 @@ -22,8 +22,6 @@ AC_ARG_WITH(v8-lib, V8_LIB_PATH="$withval"] ) -TR_STATIC_ENABLE([v8]) - AC_MSG_NOTICE([--------------------------------------------------------------------------------]) AC_MSG_NOTICE([CHECKING FOR GOOGLE V8]) AC_MSG_NOTICE([--------------------------------------------------------------------------------]) From b71f31bcbbbac0a2b8369e34b80751fd755a8c9d Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 23:43:25 +0200 Subject: [PATCH 10/14] fixed wrong error message --- arangod/V8Server/v8-vocbase.cpp | 4 ++-- js/common/modules/org/arangodb/graph-common.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index f4e68abcaf..6982b9d947 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -1093,10 +1093,10 @@ static v8::Handle SaveEdgeCol ( if (argv.Length() < 3 || argv.Length() > 4) { if (replace) { - TRI_V8_EXCEPTION_USAGE(scope, "save(, , , )"); + TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, , , [])"); } else { - TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(, , , )"); + TRI_V8_EXCEPTION_USAGE(scope, "save(, , , [])"); } } diff --git a/js/common/modules/org/arangodb/graph-common.js b/js/common/modules/org/arangodb/graph-common.js index 397fb160b4..1b8a34a811 100644 --- a/js/common/modules/org/arangodb/graph-common.js +++ b/js/common/modules/org/arangodb/graph-common.js @@ -331,7 +331,7 @@ Edge.prototype.properties = function () { //////////////////////////////////////////////////////////////////////////////// Edge.prototype._PRINT = function (context) { - if (!this._id) { + if (!this._properties._id) { context.output += "[deleted Edge]"; } else if (this._properties._key !== undefined) { @@ -507,7 +507,7 @@ Vertex.prototype.properties = function () { //////////////////////////////////////////////////////////////////////////////// Vertex.prototype._PRINT = function (context) { - if (! this._id) { + if (! this._properties._id) { context.output += "[deleted Vertex]"; } else if (this._properties._key !== undefined) { From 8fc4cd77f1bce9ca4fef57318180d6c3d5182e0f Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 6 Apr 2013 23:45:58 +0200 Subject: [PATCH 11/14] fixed wrong error message --- html/admin/js/modules/org/arangodb/graph-common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/admin/js/modules/org/arangodb/graph-common.js b/html/admin/js/modules/org/arangodb/graph-common.js index 59ec4087e1..94fd3e2769 100644 --- a/html/admin/js/modules/org/arangodb/graph-common.js +++ b/html/admin/js/modules/org/arangodb/graph-common.js @@ -332,7 +332,7 @@ Edge.prototype.properties = function () { //////////////////////////////////////////////////////////////////////////////// Edge.prototype._PRINT = function (context) { - if (!this._id) { + if (!this._properties._id) { context.output += "[deleted Edge]"; } else if (this._properties._key !== undefined) { @@ -508,7 +508,7 @@ Vertex.prototype.properties = function () { //////////////////////////////////////////////////////////////////////////////// Vertex.prototype._PRINT = function (context) { - if (! this._id) { + if (! this._properties._id) { context.output += "[deleted Vertex]"; } else if (this._properties._key !== undefined) { From 824b1aac944f7a5f32c6f0d9774f147d013eb076 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 7 Apr 2013 14:26:33 +0200 Subject: [PATCH 12/14] fixed throwing of strings --- .../modules/org/arangodb/foxx-manager.js | 82 ++++++++++++------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx-manager.js b/js/server/modules/org/arangodb/foxx-manager.js index 8927eef7e0..a2fc9213b4 100644 --- a/js/server/modules/org/arangodb/foxx-manager.js +++ b/js/server/modules/org/arangodb/foxx-manager.js @@ -90,7 +90,7 @@ function buildAssetContent (app, assets) { match = reAll.exec(asset); if (match !== null) { - throw "not implemented"; + throw new Error("not implemented"); } else { files.push(fs.join(rootDir, asset)); @@ -126,8 +126,9 @@ function installAssets (app, routes) { var route; desc = app._manifest; + if (! desc) { - throw "invalid application manifest"; + throw new Error("invalid application manifest"); } if (desc.hasOwnProperty('assets')) { @@ -195,31 +196,44 @@ function executeAppScript (app, name, mount, prefix) { desc = app._manifest; if (! desc) { - throw "invalid application manifest"; + throw new Error("invalid application manifest, app " + internal.inspect(app)); + } + + var root; + + if (app._id.substr(0,4) === "app:") { + root = module.appPath(); + } + else if (app._id.substr(0,4) === "dev:") { + root = module.devAppPath(); + } + else { + throw new Error("cannot extract root path for app '" + app._id + "', unknown type"); } if (desc.hasOwnProperty(name)) { var cp = appContext.collectionPrefix; - var context = {}; + var cname = ""; if (cp !== "") { - context.appCollectionName = function (name) { - return cp + "_" + name; - }; - - context.appCollection = function (name) { - return internal.db._collection(cp + "_" + name); - }; + cname = cp + "_"; } - else { - context.appCollectionName = function (name) { - return name; - }; - context.appCollection = function (name) { - return internal.db._collection(name); - }; - } + var context = {}; + + context.app = { + collectionName: function (name) { + return cname + name; + }, + + path: function (name) { + return fs.join(root, app._path, name); + } + }; + + context.appCollectionName = function (name) { + return name; + }; app.loadAppScript(app.createAppModule(), desc[name], appContext, context); } @@ -288,8 +302,8 @@ function installAalApp (app, mount, prefix, development) { find = aal.firstExample({ type: "mount", mount: mount, active: true }); if (find !== null) { - throw "cannot use mount path '" + mount + "', already used by '" - + find.app + "' (" + find._key + ")"; + throw new Error("cannot use mount path '" + mount + "', already used by '" + + find.app + "' (" + find._key + ")"); } // ............................................................................. @@ -339,7 +353,7 @@ function routingAalApp (app, mount, prefix) { } if (mount[0] !== "/") { - throw "mount point must be absolute"; + throw new Error("mount point must be absolute"); } // compute the collection prefix @@ -548,7 +562,7 @@ exports.installApp = function (appId, mount, options) { app = module.createApp(appId); if (app === null) { - throw "cannot find application '" + appId + "'"; + throw new Error("cannot find application '" + appId + "'"); } // ............................................................................. @@ -559,8 +573,8 @@ exports.installApp = function (appId, mount, options) { routes = routingAalApp(app, mount, prefix); if (routes === null) { - throw "cannot compute the routing table for fox application '" - + app._id + "', check the log file for errors!"; + throw new Error("cannot compute the routing table for fox application '" + + app._id + "', check the log file for errors!"); } // ............................................................................. @@ -604,7 +618,6 @@ exports.installDevApp = function (name, mount, options) { 'use strict'; var aal; - var app; var desc; var doc; var prefix; @@ -619,7 +632,7 @@ exports.installDevApp = function (name, mount, options) { var path = module.devAppPath(); if (typeof path === "undefined" || path === "") { - throw "dev-app-path is not set, cannot install development app '" + name + "'"; + throw new Error("dev-app-path is not set, cannot install development app '" + name + "'"); } var appId = null; @@ -628,11 +641,18 @@ exports.installDevApp = function (name, mount, options) { if (fs.exists(filename)) { appId = "dev:" + name + ":" + name; } + else { + throw new Error("not manifest found at '" + filename + "'"); + } - app = appId !== null && module.createApp(appId); + var app = null; + + if (appId !== null) { + app = module.createApp(appId); + } if (app === null) { - throw "cannot find development application '" + name + "'"; + throw new Error("cannot find development application '" + appId + "'"); } // ............................................................................. @@ -680,7 +700,7 @@ exports.uninstallApp = function (key) { } if (doc === null) { - throw "key '" + key + "' is neither a mount id nor a mount point"; + throw new Error("key '" + key + "' is neither a mount id nor a mount point"); } var appId = doc.app; @@ -690,7 +710,7 @@ exports.uninstallApp = function (key) { appDoc = aal.firstExample({ app: appId, type: "app" }); if (appDoc === null) { - throw "cannot find app '" + appId + "' in _aal collection"; + throw new Error("cannot find app '" + appId + "' in _aal collection"); } } From e26d2e90a78c3c2a888bf1b54a277d59cba32678 Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Mon, 8 Apr 2013 02:50:43 +0200 Subject: [PATCH 13/14] re-added doctype --- html/admin/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/html/admin/index.html b/html/admin/index.html index 2d431faa47..abdea0cea7 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -1,3 +1,4 @@ + From 0760fa8c8da458f88a714d280455c6a8eb85587a Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Mon, 8 Apr 2013 09:47:34 +0200 Subject: [PATCH 14/14] swagger.html path changed --- html/admin/api-docs.json | 2 +- html/admin/api-docs/api-docs.json | 52 +++++++++++++++++++++++++++++++ html/admin/api-docs/document | 18 +---------- html/admin/swagger.html | 2 +- 4 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 html/admin/api-docs/api-docs.json diff --git a/html/admin/api-docs.json b/html/admin/api-docs.json index e5f2fdc693..def52be025 100644 --- a/html/admin/api-docs.json +++ b/html/admin/api-docs.json @@ -1,7 +1,7 @@ { "apiVersion":"1.2beta", "swaggerVersion":"1.1", - "basePath":"http://127.0.0.1:8529/_admin/html/api-docs", + "basexPath":"http://192.168.173.10:8529/_admin/html/api-docs", "apis":[ { "path": "/document", "description": "Interface for Documents" diff --git a/html/admin/api-docs/api-docs.json b/html/admin/api-docs/api-docs.json new file mode 100644 index 0000000000..b2cb506e4c --- /dev/null +++ b/html/admin/api-docs/api-docs.json @@ -0,0 +1,52 @@ +{ + "apiVersion":"1.2beta", + "swaggerVersion":"1.1", + "apis":[ { + "path": "/document", + "description": "Interface for Documents" + }, + { + "path": "/edges", + "description": "Interface for Edges" + }, + { + "path": "/collection", + "description": "Interface for Collections" + }, + { + "path": "/graph", + "description": "Interface for Graphs" + }, + { + "path": "/user", + "description": "Interface for Users" + }, + { + "path": "/system", + "description": "Interface for System" + }, + { + "path": "/cursor", + "description": "Interface for Cursors" + }, + { + "path": "/explain", + "description": "Interface for Explain" + }, + { + "path": "/index", + "description": "Interface for Indexes" + }, + { + "path": "/simple", + "description": "Interface for SimpleQueries" + }, + { + "path": "/query", + "description": "Interface for Queries" + }, + { + "path": "/structure", + "description": "Interface for Structures" + }] + } diff --git a/html/admin/api-docs/document b/html/admin/api-docs/document index 1d0ccfd370..7e22f64346 100644 --- a/html/admin/api-docs/document +++ b/html/admin/api-docs/document @@ -67,22 +67,6 @@ "operations": [ { "errorResponses": [ - { - "reason": "If the document exists, this is returned and the JSON representation of the document is the body of the response. ", - "code": "200" - }, - { - "reason": "If the document-handle points to a non-existing document, then a HTTP 404 is returned and the body contains an error document. ", - "code": "404" - }, - { - "reason": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has a different revision than the given etag. Otherwise a HTTP 304 is returned. ", - "code": "304" - }, - { - "reason": "If the \"If-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has the same revision ad the given etag. Otherwise a HTTP 412 is returned. As an alternative you can supply the etag in an attribute rev in the URL. ", - "code": "412" - }, { "reason": "is returned if the document was found ", "code": "200" @@ -156,7 +140,7 @@ "notes": "Like GET, but only returns the header fields and not the body. You can use this call to get the current revision of a document or check if the document was deleted.

", "summary": "reads a document header", "httpMethod": "HEAD", - "examples": "

> curl -X HEAD --dump - http://localhost:8529/_api/document/73482/29591342\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"29591342\"\n

var cn = \"productshead\"; db._drop(cn); db._create(cn); var collection = db._collection(cn); var document = db.productshead.save({\"hallo\":\"world\"}); var url = \"/_api/document/\" + document._id; var response = logCurlRequest('HEAD', url, \"{}\"); assert(response.code === 200); logJsonResponse(response); db._drop(cn); @END_EXAMPLE_ARANGOSH_RUN ", + "examples": "

unix> curl --data @- --dump - http://localhost:8529/_api/document/productshead/32256602\n{}\n\n

", "nickname": "readsADocumentHeader" } ], diff --git a/html/admin/swagger.html b/html/admin/swagger.html index f063d40c5d..2885a4e211 100644 --- a/html/admin/swagger.html +++ b/html/admin/swagger.html @@ -58,7 +58,7 @@