diff --git a/Makefile.am b/Makefile.am index 47ffef0ca9..5c6c670ab2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,8 +38,10 @@ sbin_PROGRAMS = avocado bin_PROGRAMS = avocsh nobase_pkgdata_DATA = \ - $(shell find @srcdir@/js/system -name "*.js" -print) \ - $(shell find @srcdir@/js/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ + $(shell find @srcdir@/js/common/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/server/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/client/modules -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.css" -print) \ $(shell find @srcdir@/html -name "*.gif" -print) \ $(shell find @srcdir@/html -name "*.html" -print) \ diff --git a/Makefile.files b/Makefile.files index f2407d1ff9..32ea4d7392 100644 --- a/Makefile.files +++ b/Makefile.files @@ -215,13 +215,10 @@ avocsh_SOURCES = \ ################################################################################ JAVASCRIPT_HEADER = \ - js/bootstrap/js-modules.h \ - js/bootstrap/js-print.h \ + js/common/bootstrap/js-modules.h \ + js/common/bootstrap/js-print.h \ js/client/js-client.h \ - js/server/js-modules.h \ - js/server/js-aql.h \ - js/server/js-json.h \ - js/server/js-shell.h + js/server/js-server.h BUILT_SOURCES += $(JAVASCRIPT_HEADER) @@ -268,8 +265,8 @@ BUILT_SOURCES += $(BISONXX_FILES) ################################################################################ DOXYGEN = \ - Doxygen/js/bootstrap/modules.c \ - Doxygen/js/bootstrap/print.c \ + Doxygen/js/common/bootstrap/modules.c \ + Doxygen/js/common/bootstrap/print.c \ Doxygen/js/modules/actions.c \ Doxygen/js/modules/graph.c \ Doxygen/js/modules/jsunity.c \ @@ -277,8 +274,8 @@ DOXYGEN = \ Doxygen/js/server/modules.c \ Doxygen/js/server/json.c \ Doxygen/js/server/shell.c \ - Doxygen/js/system/collections.c \ - Doxygen/js/system/indexes.c + Doxygen/js/actions/system/collections.c \ + Doxygen/js/actions/system/indexes.c ################################################################################ ## wiki diff --git a/Makefile.in b/Makefile.in index fd103a2364..6d4963b5be 100644 --- a/Makefile.in +++ b/Makefile.in @@ -522,8 +522,10 @@ CLEANUP = $(DOXYGEN) $(WIKI) $(subst Doxygen/xml,Doxygen/wiki,$(WIKI)) \ $(JAVASCRIPT_HEADER) $(am__append_1) $(am__append_2) noinst_LIBRARIES = libavocado.a nobase_pkgdata_DATA = \ - $(shell find @srcdir@/js/system -name "*.js" -print) \ - $(shell find @srcdir@/js/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ + $(shell find @srcdir@/js/common/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/server/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/client/modules -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.css" -print) \ $(shell find @srcdir@/html -name "*.gif" -print) \ $(shell find @srcdir@/html -name "*.html" -print) \ @@ -737,13 +739,10 @@ avocsh_SOURCES = \ ################################################################################ ################################################################################ JAVASCRIPT_HEADER = \ - js/bootstrap/js-modules.h \ - js/bootstrap/js-print.h \ + js/common/bootstrap/js-modules.h \ + js/common/bootstrap/js-print.h \ js/client/js-client.h \ - js/server/js-modules.h \ - js/server/js-aql.h \ - js/server/js-json.h \ - js/server/js-shell.h + js/server/js-server.h ################################################################################ @@ -775,8 +774,8 @@ BISONXX_FILES = \ ################################################################################ ################################################################################ DOXYGEN = \ - Doxygen/js/bootstrap/modules.c \ - Doxygen/js/bootstrap/print.c \ + Doxygen/js/common/bootstrap/modules.c \ + Doxygen/js/common/bootstrap/print.c \ Doxygen/js/modules/actions.c \ Doxygen/js/modules/graph.c \ Doxygen/js/modules/jsunity.c \ @@ -784,8 +783,8 @@ DOXYGEN = \ Doxygen/js/server/modules.c \ Doxygen/js/server/json.c \ Doxygen/js/server/shell.c \ - Doxygen/js/system/collections.c \ - Doxygen/js/system/indexes.c + Doxygen/js/actions/system/collections.c \ + Doxygen/js/actions/system/indexes.c ################################################################################ @@ -2430,7 +2429,7 @@ wiki: $(WIKI) js/js-%.h: @srcdir@/js/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ -js/bootstrap/js-%.h: @srcdir@/js/bootstrap/%.js .setup-directories +js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ js/client/js-%.h: @srcdir@/js/client/%.js .setup-directories diff --git a/Makefile.javascript b/Makefile.javascript index c743c8953b..4f0e5f87af 100644 --- a/Makefile.javascript +++ b/Makefile.javascript @@ -16,7 +16,7 @@ BUILT_SOURCES += .setup-directories js/js-%.h: @srcdir@/js/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ -js/bootstrap/js-%.h: @srcdir@/js/bootstrap/%.js .setup-directories +js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ js/client/js-%.h: @srcdir@/js/client/%.js .setup-directories diff --git a/RestServer/AvocadoServer.cpp b/RestServer/AvocadoServer.cpp index 141421d324..a96c9145da 100644 --- a/RestServer/AvocadoServer.cpp +++ b/RestServer/AvocadoServer.cpp @@ -65,12 +65,9 @@ using namespace triagens::rest; using namespace triagens::admin; using namespace triagens::avocado; -#include "js/bootstrap/js-modules.h" -#include "js/bootstrap/js-print.h" -#include "js/server/js-aql.h" -#include "js/server/js-json.h" -#include "js/server/js-modules.h" -#include "js/server/js-shell.h" +#include "js/common/bootstrap/js-modules.h" +#include "js/common/bootstrap/js-print.h" +#include "js/server/js-server.h" // ----------------------------------------------------------------------------- // --SECTION-- private variables @@ -372,12 +369,9 @@ void AvocadoServer::buildApplicationServer () { if (_startupPath.empty()) { LOGGER_INFO << "using built-in JavaScript startup files"; - StartupLoader.defineScript("bootstrap/modules.js", JS_bootstrap_modules); - StartupLoader.defineScript("bootstrap/print.js", JS_bootstrap_print); - StartupLoader.defineScript("server/modules.js", JS_server_modules); - StartupLoader.defineScript("server/aql.js", JS_server_aql); - StartupLoader.defineScript("server/json.js", JS_server_json); - StartupLoader.defineScript("server/shell.js", JS_server_shell); + StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); + StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); + StartupLoader.defineScript("server/server.js", JS_server_server); } else { LOGGER_INFO << "using JavaScript startup files at '" << _startupPath << "'"; diff --git a/V8Client/shell.cpp b/V8Client/shell.cpp index b61842a507..bab7b21ce0 100644 --- a/V8Client/shell.cpp +++ b/V8Client/shell.cpp @@ -54,8 +54,8 @@ using namespace triagens::httpclient; using namespace triagens::v8client; using namespace triagens::avocado; -#include "js/bootstrap/js-print.h" -#include "js/bootstrap/js-modules.h" +#include "js/common/bootstrap/js-print.h" +#include "js/common/bootstrap/js-modules.h" #include "js/client/js-client.h" // ----------------------------------------------------------------------------- @@ -950,8 +950,8 @@ int main (int argc, char* argv[]) { // load java script from js/bootstrap/*.h files if (StartupPath.empty()) { - StartupLoader.defineScript("bootstrap/modules.js", JS_bootstrap_modules); - StartupLoader.defineScript("bootstrap/print.js", JS_bootstrap_print); + StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); + StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); StartupLoader.defineScript("client/client.js", JS_client_client); } else { diff --git a/js/actions/geo.js b/js/actions/demo/geo.js similarity index 100% rename from js/actions/geo.js rename to js/actions/demo/geo.js diff --git a/js/actions/hallo-world.js b/js/actions/demo/hallo-world.js similarity index 100% rename from js/actions/hallo-world.js rename to js/actions/demo/hallo-world.js diff --git a/js/system/api-help.js b/js/actions/system/api-help.js similarity index 100% rename from js/system/api-help.js rename to js/actions/system/api-help.js diff --git a/js/system/aql-cursor.js b/js/actions/system/aql-cursor.js similarity index 100% rename from js/system/aql-cursor.js rename to js/actions/system/aql-cursor.js diff --git a/js/system/aql-query.js b/js/actions/system/aql-query.js similarity index 100% rename from js/system/aql-query.js rename to js/actions/system/aql-query.js diff --git a/js/system/collection.js b/js/actions/system/collection.js similarity index 100% rename from js/system/collection.js rename to js/actions/system/collection.js diff --git a/js/system/collections.js b/js/actions/system/collections.js similarity index 100% rename from js/system/collections.js rename to js/actions/system/collections.js diff --git a/js/system/document.js b/js/actions/system/document.js similarity index 100% rename from js/system/document.js rename to js/actions/system/document.js diff --git a/js/system/documents.js b/js/actions/system/documents.js similarity index 100% rename from js/system/documents.js rename to js/actions/system/documents.js diff --git a/js/system/front-end.js b/js/actions/system/front-end.js similarity index 100% rename from js/system/front-end.js rename to js/actions/system/front-end.js diff --git a/js/bootstrap/js-modules.h b/js/common/bootstrap/js-modules.h similarity index 99% rename from js/bootstrap/js-modules.h rename to js/common/bootstrap/js-modules.h index 4ad7b0e752..87bee0edb4 100644 --- a/js/bootstrap/js-modules.h +++ b/js/common/bootstrap/js-modules.h @@ -1,4 +1,4 @@ -static string JS_bootstrap_modules = +static string JS_common_bootstrap_modules = "////////////////////////////////////////////////////////////////////////////////\n" "/// @brief JavaScript server functions\n" "///\n" diff --git a/js/bootstrap/js-print.h b/js/common/bootstrap/js-print.h similarity index 99% rename from js/bootstrap/js-print.h rename to js/common/bootstrap/js-print.h index c538344a55..1e62bbb465 100644 --- a/js/bootstrap/js-print.h +++ b/js/common/bootstrap/js-print.h @@ -1,4 +1,4 @@ -static string JS_bootstrap_print = +static string JS_common_bootstrap_print = "////////////////////////////////////////////////////////////////////////////////\n" "/// @brief printing\n" "///\n" diff --git a/js/bootstrap/modules.js b/js/common/bootstrap/modules.js similarity index 100% rename from js/bootstrap/modules.js rename to js/common/bootstrap/modules.js diff --git a/js/bootstrap/print.js b/js/common/bootstrap/print.js similarity index 100% rename from js/bootstrap/print.js rename to js/common/bootstrap/print.js diff --git a/js/modules/graph.js b/js/common/modules/graph.js similarity index 100% rename from js/modules/graph.js rename to js/common/modules/graph.js diff --git a/js/modules/jsunity.js b/js/common/modules/jsunity.js similarity index 100% rename from js/modules/jsunity.js rename to js/common/modules/jsunity.js diff --git a/js/modules/jsunity/jsunity.js b/js/common/modules/jsunity/jsunity.js similarity index 100% rename from js/modules/jsunity/jsunity.js rename to js/common/modules/jsunity/jsunity.js diff --git a/js/tests/aql_geo_tests.js b/js/common/tests/simple-queries-geo.js similarity index 100% rename from js/tests/aql_geo_tests.js rename to js/common/tests/simple-queries-geo.js diff --git a/js/tests/aql_tests.js b/js/common/tests/simple-queries.js similarity index 100% rename from js/tests/aql_tests.js rename to js/common/tests/simple-queries.js diff --git a/js/server/js-server.h b/js/server/js-server.h new file mode 100644 index 0000000000..222c2e676a --- /dev/null +++ b/js/server/js-server.h @@ -0,0 +1,156 @@ +static string JS_server_server = + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief JavaScript server functions\n" + "///\n" + "/// @file\n" + "///\n" + "/// DISCLAIMER\n" + "///\n" + "/// Copyright 2011-2012 triagens GmbH, Cologne, Germany\n" + "///\n" + "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "/// you may not use this file except in compliance with the License.\n" + "/// You may obtain a copy of the License at\n" + "///\n" + "/// http://www.apache.org/licenses/LICENSE-2.0\n" + "///\n" + "/// Unless required by applicable law or agreed to in writing, software\n" + "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "/// See the License for the specific language governing permissions and\n" + "/// limitations under the License.\n" + "///\n" + "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" + "///\n" + "/// @author Dr. Frank Celler\n" + "/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @page JSModuleAvocadoTOC\n" + "///\n" + "///