mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
5427faf930
|
@ -174,9 +174,9 @@ TRI_index_t* TRI_CreateCapConstraint (struct TRI_primary_collection_s* primary,
|
||||||
cap = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_cap_constraint_t), false);
|
cap = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_cap_constraint_t), false);
|
||||||
idx = &cap->base;
|
idx = &cap->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNameCapConstraint;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_CAP_CONSTRAINT, primary, false, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_CAP_CONSTRAINT, primary, false, true);
|
||||||
|
|
||||||
idx->typeName = TypeNameCapConstraint;
|
|
||||||
idx->json = JsonCapConstraint;
|
idx->json = JsonCapConstraint;
|
||||||
idx->removeIndex = RemoveIndexCapConstraint;
|
idx->removeIndex = RemoveIndexCapConstraint;
|
||||||
idx->insert = InsertCapConstraint;
|
idx->insert = InsertCapConstraint;
|
||||||
|
|
|
@ -499,10 +499,11 @@ TRI_index_t* TRI_CreateGeo1Index (struct TRI_primary_collection_s* primary,
|
||||||
|
|
||||||
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
||||||
|
|
||||||
|
idx->typeName = TypeNameGeo1Index;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_GEO1_INDEX, primary, false, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_GEO1_INDEX, primary, false, true);
|
||||||
|
|
||||||
idx->_ignoreNull = ignoreNull;
|
idx->_ignoreNull = ignoreNull;
|
||||||
|
|
||||||
idx->typeName = TypeNameGeo1Index;
|
|
||||||
idx->json = JsonGeo1Index;
|
idx->json = JsonGeo1Index;
|
||||||
idx->insert = InsertGeoIndex;
|
idx->insert = InsertGeoIndex;
|
||||||
idx->remove = RemoveGeoIndex;
|
idx->remove = RemoveGeoIndex;
|
||||||
|
@ -554,10 +555,11 @@ TRI_index_t* TRI_CreateGeo2Index (struct TRI_primary_collection_s* primary,
|
||||||
|
|
||||||
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
||||||
|
|
||||||
|
idx->typeName = TypeNameGeo2Index;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_GEO2_INDEX, primary, false, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_GEO2_INDEX, primary, false, true);
|
||||||
|
|
||||||
idx->_ignoreNull = ignoreNull;
|
idx->_ignoreNull = ignoreNull;
|
||||||
|
|
||||||
idx->typeName = TypeNameGeo2Index;
|
|
||||||
idx->json = JsonGeo2Index;
|
idx->json = JsonGeo2Index;
|
||||||
idx->insert = InsertGeoIndex;
|
idx->insert = InsertGeoIndex;
|
||||||
idx->remove = RemoveGeoIndex;
|
idx->remove = RemoveGeoIndex;
|
||||||
|
|
|
@ -582,9 +582,9 @@ TRI_index_t* TRI_CreateHashIndex (struct TRI_primary_collection_s* primary,
|
||||||
hashIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_hash_index_t), false);
|
hashIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_hash_index_t), false);
|
||||||
idx = &hashIndex->base;
|
idx = &hashIndex->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNameHashIndex;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_HASH_INDEX, primary, unique, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_HASH_INDEX, primary, unique, true);
|
||||||
|
|
||||||
idx->typeName = TypeNameHashIndex;
|
|
||||||
idx->json = JsonHashIndex;
|
idx->json = JsonHashIndex;
|
||||||
idx->insert = InsertHashIndex;
|
idx->insert = InsertHashIndex;
|
||||||
idx->remove = RemoveHashIndex;
|
idx->remove = RemoveHashIndex;
|
||||||
|
|
|
@ -483,12 +483,12 @@ TRI_index_t* TRI_CreatePrimaryIndex (struct TRI_primary_collection_s* primary) {
|
||||||
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
||||||
TRI_PushBackVectorString(&idx->_fields, id);
|
TRI_PushBackVectorString(&idx->_fields, id);
|
||||||
|
|
||||||
|
idx->typeName = TypeNamePrimary;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_PRIMARY_INDEX, primary, true, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_PRIMARY_INDEX, primary, true, true);
|
||||||
|
|
||||||
// override iid
|
// override iid
|
||||||
idx->_iid = 0;
|
idx->_iid = 0;
|
||||||
|
|
||||||
idx->typeName = TypeNamePrimary;
|
|
||||||
idx->json = JsonPrimary;
|
idx->json = JsonPrimary;
|
||||||
idx->insert = InsertPrimary;
|
idx->insert = InsertPrimary;
|
||||||
idx->remove = RemovePrimary;
|
idx->remove = RemovePrimary;
|
||||||
|
@ -778,9 +778,9 @@ TRI_index_t* TRI_CreateEdgeIndex (struct TRI_primary_collection_s* primary) {
|
||||||
id = TRI_DuplicateStringZ(TRI_CORE_MEM_ZONE, "_from");
|
id = TRI_DuplicateStringZ(TRI_CORE_MEM_ZONE, "_from");
|
||||||
TRI_PushBackVectorString(&idx->_fields, id);
|
TRI_PushBackVectorString(&idx->_fields, id);
|
||||||
|
|
||||||
|
idx->typeName = TypeNameEdge;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_EDGE_INDEX, primary, false, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_EDGE_INDEX, primary, false, true);
|
||||||
|
|
||||||
idx->typeName = TypeNameEdge;
|
|
||||||
idx->json = JsonEdge;
|
idx->json = JsonEdge;
|
||||||
idx->insert = InsertEdge;
|
idx->insert = InsertEdge;
|
||||||
idx->remove = RemoveEdge;
|
idx->remove = RemoveEdge;
|
||||||
|
@ -1133,9 +1133,9 @@ TRI_index_t* TRI_CreatePriorityQueueIndex (struct TRI_primary_collection_s* prim
|
||||||
pqIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_priorityqueue_index_t), false);
|
pqIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_priorityqueue_index_t), false);
|
||||||
idx = &pqIndex->base;
|
idx = &pqIndex->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNamePriorityQueueIndex;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_PRIORITY_QUEUE_INDEX, primary, unique, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_PRIORITY_QUEUE_INDEX, primary, unique, true);
|
||||||
|
|
||||||
idx->typeName = TypeNamePriorityQueueIndex;
|
|
||||||
idx->json = JsonPriorityQueueIndex;
|
idx->json = JsonPriorityQueueIndex;
|
||||||
idx->insert = InsertPriorityQueueIndex;
|
idx->insert = InsertPriorityQueueIndex;
|
||||||
idx->remove = RemovePriorityQueueIndex;
|
idx->remove = RemovePriorityQueueIndex;
|
||||||
|
@ -1776,9 +1776,9 @@ TRI_index_t* TRI_CreateSkiplistIndex (struct TRI_primary_collection_s* primary,
|
||||||
skiplistIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_skiplist_index_t), false);
|
skiplistIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_skiplist_index_t), false);
|
||||||
idx = &skiplistIndex->base;
|
idx = &skiplistIndex->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNameSkiplistIndex;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_SKIPLIST_INDEX, primary, unique, false);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_SKIPLIST_INDEX, primary, unique, false);
|
||||||
|
|
||||||
idx->typeName = TypeNameSkiplistIndex;
|
|
||||||
idx->json = JsonSkiplistIndex;
|
idx->json = JsonSkiplistIndex;
|
||||||
idx->insert = InsertSkiplistIndex;
|
idx->insert = InsertSkiplistIndex;
|
||||||
idx->remove = RemoveSkiplistIndex;
|
idx->remove = RemoveSkiplistIndex;
|
||||||
|
@ -2113,9 +2113,9 @@ TRI_index_t* TRI_CreateFulltextIndex (struct TRI_primary_collection_s* primary,
|
||||||
|
|
||||||
idx = &fulltextIndex->base;
|
idx = &fulltextIndex->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNameFulltextIndex;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_FULLTEXT_INDEX, primary, false, true);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_FULLTEXT_INDEX, primary, false, true);
|
||||||
|
|
||||||
idx->typeName = TypeNameFulltextIndex;
|
|
||||||
idx->json = JsonFulltextIndex;
|
idx->json = JsonFulltextIndex;
|
||||||
idx->insert = InsertFulltextIndex;
|
idx->insert = InsertFulltextIndex;
|
||||||
idx->remove = RemoveFulltextIndex;
|
idx->remove = RemoveFulltextIndex;
|
||||||
|
@ -2806,9 +2806,9 @@ TRI_index_t* TRI_CreateBitarrayIndex (struct TRI_primary_collection_s* primary,
|
||||||
baIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_bitarray_index_t), false);
|
baIndex = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_bitarray_index_t), false);
|
||||||
idx = &baIndex->base;
|
idx = &baIndex->base;
|
||||||
|
|
||||||
|
idx->typeName = TypeNameBitarrayIndex;
|
||||||
TRI_InitIndex(idx, TRI_IDX_TYPE_BITARRAY_INDEX, primary, false, false);
|
TRI_InitIndex(idx, TRI_IDX_TYPE_BITARRAY_INDEX, primary, false, false);
|
||||||
|
|
||||||
idx->typeName = TypeNameBitarrayIndex;
|
|
||||||
idx->json = JsonBitarrayIndex;
|
idx->json = JsonBitarrayIndex;
|
||||||
idx->insert = InsertBitarrayIndex;
|
idx->insert = InsertBitarrayIndex;
|
||||||
idx->remove = RemoveBitarrayIndex;
|
idx->remove = RemoveBitarrayIndex;
|
||||||
|
|
|
@ -138,8 +138,7 @@
|
||||||
|
|
||||||
internal.executeServer = function (body) {
|
internal.executeServer = function (body) {
|
||||||
if (typeof internal.arango !== 'undefined') {
|
if (typeof internal.arango !== 'undefined') {
|
||||||
internal.arango.POST("/_admin/execute", body);
|
return internal.arango.POST("/_admin/execute", body);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw "not connected";
|
throw "not connected";
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, module */
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief foxx administration actions
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Dr. Frank Celler
|
||||||
|
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var arangodb = require("org/arangodb");
|
||||||
|
var actions = require("org/arangodb/actions");
|
||||||
|
var foxx = require("org/arangodb/foxx");
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public functions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoAPI
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief reloads the server authentication information
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
actions.defineHttp({
|
||||||
|
url : "_admin/foxx/load",
|
||||||
|
context : "admin",
|
||||||
|
prefix : false,
|
||||||
|
|
||||||
|
callback : function (req, res) {
|
||||||
|
var result;
|
||||||
|
var body = actions.getJsonBody(req, res);
|
||||||
|
|
||||||
|
if (body === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! body.hasOwnProperty("manifest")) {
|
||||||
|
actions.resultBad(req,
|
||||||
|
res,
|
||||||
|
arangodb.ERROR_HTTP_BAD_PARAMETER,
|
||||||
|
"body must specify a 'manifest'");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = foxx.loadManifest(body.manifest);
|
||||||
|
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- END-OF-FILE
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}"
|
||||||
|
// End:
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, nonpropdel: true */
|
||||||
|
/*global require, ArangoConnection, print, SYS_ARANGO */
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief module "internal"
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Dr. Frank Celler
|
||||||
|
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var internal = require("internal");
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public functions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup Foxx
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief loads a foxx manifest
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
exports.loadManifest = function (name) {
|
||||||
|
var result = { manifest: name };
|
||||||
|
|
||||||
|
return internal.arango.POST("/_admin/foxx/load", JSON.stringify(result));
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- END-OF-FILE
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "/// @brief\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\|/\\*jslint"
|
||||||
|
// End:
|
|
@ -731,17 +731,29 @@ function stop_color_print () {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Module.prototype.loadAppScript = function (unormalizedPath, manifest, appfile) {
|
Module.prototype.loadAppScript = function (unormalizedPath, manifest, appfile) {
|
||||||
var fun;
|
|
||||||
var result;
|
|
||||||
var path = this.normalize(unormalizedPath);
|
var path = this.normalize(unormalizedPath);
|
||||||
var pkg = new Package("application",
|
|
||||||
{name: "application '" + appfile + "'"},
|
|
||||||
undefined,
|
|
||||||
path);
|
|
||||||
var mdl = new Module("application", 'application', pkg);
|
|
||||||
var file = this.normalize(path + "/" + appfile);
|
var file = this.normalize(path + "/" + appfile);
|
||||||
var content;
|
|
||||||
var sandbox = {};
|
var sandbox = {};
|
||||||
|
var content;
|
||||||
|
var fun;
|
||||||
|
var libpath;
|
||||||
|
var mdl;
|
||||||
|
var pkg;
|
||||||
|
var result;
|
||||||
|
|
||||||
|
if (manifest.hasOwnProperty("lib")) {
|
||||||
|
libpath = path + "/" + manifest.lib;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
libpath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg = new Package("application",
|
||||||
|
{name: "application '" + appfile + "'"},
|
||||||
|
undefined,
|
||||||
|
[ libpath ]);
|
||||||
|
|
||||||
|
mdl = new Module("application", 'application', pkg);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
content = internal.read(file);
|
content = internal.read(file);
|
||||||
|
|
|
@ -15,6 +15,8 @@ var FoxxApplication,
|
||||||
FormatMiddleware,
|
FormatMiddleware,
|
||||||
_ = require("underscore"),
|
_ = require("underscore"),
|
||||||
db = require("org/arangodb").db,
|
db = require("org/arangodb").db,
|
||||||
|
fs = require("fs"),
|
||||||
|
console = require("console"),
|
||||||
internal = {};
|
internal = {};
|
||||||
|
|
||||||
// ArangoDB uses a certain structure we refer to as `UrlObject`.
|
// ArangoDB uses a certain structure we refer to as `UrlObject`.
|
||||||
|
@ -561,8 +563,41 @@ FormatMiddleware = function (allowedFormats, defaultFormat) {
|
||||||
|
|
||||||
// We finish off with exporting FoxxApplication and the middlewares.
|
// We finish off with exporting FoxxApplication and the middlewares.
|
||||||
// Everything else will remain our secret.
|
// Everything else will remain our secret.
|
||||||
//
|
|
||||||
// Fin.
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief loads a manifest file
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
exports.loadManifest = function (path) {
|
||||||
|
var name;
|
||||||
|
var content;
|
||||||
|
var manifest;
|
||||||
|
var key;
|
||||||
|
|
||||||
|
name = fs.join(path, "manifest.json");
|
||||||
|
content = fs.read(name);
|
||||||
|
manifest = JSON.parse(content);
|
||||||
|
|
||||||
|
for (key in manifest.apps) {
|
||||||
|
if (manifest.apps.hasOwnProperty(key)) {
|
||||||
|
var app = manifest.apps[key];
|
||||||
|
|
||||||
|
console.info("loading app '%s' from '%s'", key, app);
|
||||||
|
|
||||||
|
module.loadAppScript(path, manifest, app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.FoxxApplication = FoxxApplication;
|
exports.FoxxApplication = FoxxApplication;
|
||||||
exports.BaseMiddleware = BaseMiddleware;
|
exports.BaseMiddleware = BaseMiddleware;
|
||||||
exports.FormatMiddleware = FormatMiddleware;
|
exports.FormatMiddleware = FormatMiddleware;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- END-OF-FILE
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "/// @brief\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\|/\\*jslint"
|
||||||
|
// End:
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100 */
|
|
||||||
/*global require, exports */
|
|
||||||
|
|
||||||
// Fuxx is an easy way to create APIs and simple web applications
|
|
||||||
// from within **ArangoDB**.
|
|
||||||
// It is inspired by Sinatra, the classy Ruby web framework. If FuxxApplication is Sinatra,
|
|
||||||
// [ArangoDB Actions](http://www.arangodb.org/manuals/current/UserManualActions.html)
|
|
||||||
// are the corresponding `Rack`. They provide all the HTTP goodness.
|
|
||||||
//
|
|
||||||
// So let's get started, shall we?
|
|
||||||
|
|
||||||
// FuxxApplication uses Underscore internally. This library is wonderful.
|
|
||||||
var FuxxApplication,
|
|
||||||
BaseMiddleware,
|
|
||||||
FormatMiddleware,
|
|
||||||
_ = require("underscore"),
|
|
||||||
db = require("org/arangodb").db,
|
|
||||||
fs = require("fs"),
|
|
||||||
console = require("console"),
|
|
||||||
internal = {};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief loads a manifest file
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
exports.loadManifest = function (path) {
|
|
||||||
var name;
|
|
||||||
var content;
|
|
||||||
var manifest;
|
|
||||||
var key;
|
|
||||||
|
|
||||||
name = fs.join(path, "manifest.json");
|
|
||||||
content = fs.read(name);
|
|
||||||
manifest = JSON.parse(content);
|
|
||||||
|
|
||||||
for (key in manifest.apps) {
|
|
||||||
if (manifest.apps.hasOwnProperty(key)) {
|
|
||||||
var app = manifest.apps[key];
|
|
||||||
|
|
||||||
console.info("loading app '%s' from '%s'", key, app);
|
|
||||||
|
|
||||||
module.loadAppScript(path, manifest, app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
@ -365,6 +365,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
||||||
TRI_Free(shaper->_memoryZone, values);
|
TRI_Free(shaper->_memoryZone, values);
|
||||||
TRI_Free(shaper->_memoryZone, shape);
|
TRI_Free(shaper->_memoryZone, shape);
|
||||||
|
|
||||||
|
LOG_TRACE("shaper failed to find shape of type %d", (int) shape->base._type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +434,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
||||||
TRI_Free(shaper->_memoryZone, values);
|
TRI_Free(shaper->_memoryZone, values);
|
||||||
TRI_Free(shaper->_memoryZone, shape);
|
TRI_Free(shaper->_memoryZone, shape);
|
||||||
|
|
||||||
|
LOG_TRACE("shaper failed to find shape %d", (int) shape->base._type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,6 +758,7 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper,
|
||||||
found = shaper->findShape(shaper, &a->base);
|
found = shaper->findShape(shaper, &a->base);
|
||||||
|
|
||||||
if (found == 0) {
|
if (found == 0) {
|
||||||
|
LOG_TRACE("shaper failed to find shape %d", (int) a->base._type);
|
||||||
TRI_Free(shaper->_memoryZone, a);
|
TRI_Free(shaper->_memoryZone, a);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -835,6 +838,32 @@ static bool FillShapeValueJson (TRI_shaper_t* shaper,
|
||||||
return FillShapeValueArray(shaper, dst, json->ToObject(), seenHashes, seenObjects);
|
return FillShapeValueArray(shaper, dst, json->ToObject(), seenHashes, seenObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (json->IsRegExp()) {
|
||||||
|
LOG_TRACE("shaper failed because a regexp cannot be converted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json->IsFunction()) {
|
||||||
|
LOG_TRACE("shaper failed because a function cannot be converted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json->IsExternal()) {
|
||||||
|
LOG_TRACE("shaper failed because an external cannot be converted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json->IsDate()) {
|
||||||
|
LOG_TRACE("shaper failed because a date cannot be converted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json->IsUndefined()) {
|
||||||
|
LOG_TRACE("shaper failed because an undefined cannot be converted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_TRACE("shaper failed to convert object");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue