1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Michael Hackstein 2014-06-04 11:49:33 +02:00
commit 7e511ddaa9
16 changed files with 264 additions and 266 deletions

View File

@ -35,6 +35,8 @@ v2.2.0 (XXXX-XX-XX)
v2.1.1 (2014-06-06) v2.1.1 (2014-06-06)
------------------- -------------------
* fixed dfdb: should not start any other V8 threads
* signature for collection functions was modified * signature for collection functions was modified
The basic change was the substitution of the input parameter of the The basic change was the substitution of the input parameter of the

View File

@ -247,7 +247,7 @@ pack-winXX-cmake:
cd Build$(BITS) && cpack -G NSIS cd Build$(BITS) && cpack -G NSIS
./installer-generator.sh $(BITS) ./Installation/Windows/installer-generator.sh $(BITS) $(shell pwd)
################################################################################ ################################################################################
### @brief Windows Vista 64-bit bundle ### @brief Windows Vista 64-bit bundle

View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
NSIS_PATH="/cygdrive/c/Program Files (x86)/NSIS" NSIS_PATH="/cygdrive/c/Program Files (x86)/NSIS"
#shell parameter:
#1 the bits (64 or 32)
#2 the parent directory which contains the Build64 or Build32 directory
cd $2
bits=$1 bits=$1
INSTALLERNAME=`grep CPACK_PACKAGE_FILE_NAME Build$bits/CPackConfig.cmake | grep -o '".*"' | awk -F\" '{print $2}'` INSTALLERNAME=`grep CPACK_PACKAGE_FILE_NAME Build$bits/CPackConfig.cmake | grep -o '".*"' | awk -F\" '{print $2}'`
if [ ! -f Build$bits/$INSTALLERNAME-internal.exe ]; then if [ ! -f Build$bits/$INSTALLERNAME-internal.exe ]; then

View File

@ -491,6 +491,7 @@ void ArangoServer::buildApplicationServer () {
additional[ApplicationServer::OPTIONS_HIDDEN] additional[ApplicationServer::OPTIONS_HIDDEN]
("no-upgrade", "skip a database upgrade") ("no-upgrade", "skip a database upgrade")
("start-service", "used to start as windows service") ("start-service", "used to start as windows service")
("no-server", "do not start the server, if console is requested")
; ;
// ............................................................................. // .............................................................................
@ -763,6 +764,11 @@ void ArangoServer::buildApplicationServer () {
int ArangoServer::startupServer () { int ArangoServer::startupServer () {
OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions()); OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions());
bool startServer = true;
if (_applicationServer->programOptions().has("no-server")) {
startServer = false;
}
// ............................................................................. // .............................................................................
// prepare the various parts of the Arango server // prepare the various parts of the Arango server
@ -789,8 +795,10 @@ int ArangoServer::startupServer () {
if (mode == OperationMode::MODE_CONSOLE) { if (mode == OperationMode::MODE_CONSOLE) {
// one V8 instance is taken by the console // one V8 instance is taken by the console
if (startServer) {
++concurrency; ++concurrency;
} }
}
else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) { else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) {
if (concurrency == 1) { if (concurrency == 1) {
// at least two to allow the test-runner and the scheduler to use a V8 // at least two to allow the test-runner and the scheduler to use a V8
@ -823,11 +831,21 @@ int ArangoServer::startupServer () {
// prepare everything // prepare everything
// ............................................................................. // .............................................................................
if (! startServer) {
_applicationScheduler->disable();
_applicationDispatcher->disable();
_applicationEndpointServer->disable();
_applicationV8->disableActions();
_applicationV8->setStartupFile("");
}
// prepare scheduler and dispatcher // prepare scheduler and dispatcher
_applicationServer->prepare(); _applicationServer->prepare();
// now we can create the queues // now we can create the queues
if (startServer) {
_applicationDispatcher->buildStandardQueue(_dispatcherThreads, (int) _dispatcherQueueSize); _applicationDispatcher->buildStandardQueue(_dispatcherThreads, (int) _dispatcherQueueSize);
}
// and finish prepare // and finish prepare
_applicationServer->prepare2(); _applicationServer->prepare2();
@ -840,7 +858,9 @@ int ArangoServer::startupServer () {
_applicationV8->runVersionCheck(skipUpgrade, performUpgrade); _applicationV8->runVersionCheck(skipUpgrade, performUpgrade);
// setup the V8 actions // setup the V8 actions
if (startServer) {
_applicationV8->prepareActions(); _applicationV8->prepareActions();
}
// ............................................................................. // .............................................................................
// create endpoints and handlers // create endpoints and handlers
@ -851,6 +871,8 @@ int ArangoServer::startupServer () {
httpOptions._vocbase = vocbase; httpOptions._vocbase = vocbase;
httpOptions._queue = "STANDARD"; httpOptions._queue = "STANDARD";
if (startServer) {
// create the handlers // create the handlers
httpOptions._contexts.insert("user"); httpOptions._contexts.insert("user");
httpOptions._contexts.insert("api"); httpOptions._contexts.insert("api");
@ -869,6 +891,7 @@ int ArangoServer::startupServer () {
"/", "/",
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>, RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
(void*) &httpOptions); (void*) &httpOptions);
}
// ............................................................................. // .............................................................................
// start the main event loop // start the main event loop

View File

@ -249,7 +249,9 @@ ApplicationV8::ApplicationV8 (TRI_server_t* server,
_stopping(0), _stopping(0),
_gcThread(0), _gcThread(0),
_scheduler(scheduler), _scheduler(scheduler),
_dispatcher(dispatcher) { _dispatcher(dispatcher),
_definedBooleans(),
_startupFile("server/server.js") {
assert(_server != 0); assert(_server != 0);
} }
@ -784,6 +786,14 @@ void ApplicationV8::prepareActions () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief sets an alternate init file
////////////////////////////////////////////////////////////////////////////////
void ApplicationV8::setStartupFile (const string& file) {
_startupFile = file;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -927,7 +937,7 @@ void ApplicationV8::close () {
_contextCondition.broadcast(); _contextCondition.broadcast();
// unregister all tasks // unregister all tasks
if (_scheduler != nullptr) { if (_scheduler != nullptr && _scheduler->scheduler() != nullptr) {
_scheduler->scheduler()->unregisterUserTasks(); _scheduler->scheduler()->unregisterUserTasks();
} }
@ -1006,7 +1016,10 @@ bool ApplicationV8::prepareV8Instance (const size_t i) {
files.push_back("common/bootstrap/monkeypatches.js"); files.push_back("common/bootstrap/monkeypatches.js");
files.push_back("server/bootstrap/module-internal.js"); files.push_back("server/bootstrap/module-internal.js");
files.push_back("server/server.js"); // needs internal
if (! _startupFile.empty()) {
files.push_back(_startupFile); // needs internal
}
LOG_TRACE("initialising V8 context #%d", (int) i); LOG_TRACE("initialising V8 context #%d", (int) i);

View File

@ -334,6 +334,14 @@ namespace triagens {
void prepareActions (); void prepareActions ();
////////////////////////////////////////////////////////////////////////////////
/// @brief sets an alternate init file
///
/// Normally "server.js" will be used. Pass empty string to disable.
////////////////////////////////////////////////////////////////////////////////
void setStartupFile (const string&);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -625,6 +633,12 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::map<std::string, bool> _definedBooleans; std::map<std::string, bool> _definedBooleans;
////////////////////////////////////////////////////////////////////////////////
/// @brief startup file
////////////////////////////////////////////////////////////////////////////////
std::string _startupFile;
}; };
} }
} }

View File

@ -1,4 +1,5 @@
no-upgrade = true no-upgrade = true
no-server = true
[database] [database]
directory= @LOCALSTATEDIR@/lib/arangodb directory= @LOCALSTATEDIR@/lib/arangodb

View File

@ -1,4 +1,5 @@
no-upgrade = true no-upgrade = true
no-server = true
[database] [database]
# directory= /var/arangodb # directory= /var/arangodb

View File

@ -861,32 +861,32 @@ ArangoCollection.prototype.iterate = function (iterator, options) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief removes documents matching an example /// @brief removes documents matching an example
/// /// @startDocuBlock documents_collectionRemoveByExample
/// @FUN{@FA{collection}.removeByExample(@FA{example})} /// `collection.removeByExample(example)`
/// ///
/// Removes all documents matching an example. /// Removes all documents matching an example.
/// ///
/// @FUN{@FA{collection}.removeByExample(@FA{document}, @FA{waitForSync})} /// `collection.removeByExample(document, waitForSync)`
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronisation
/// of the document deletion operation to disk even in case that the /// of the document deletion operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.removeByExample(@FA{document}, @FA{waitForSync}, @FA{limit})} /// `collection.removeByExample(document, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// removals to the specified value. If @FA{limit} is specified but less than the /// removals to the specified value. If *limit* is specified but less than the
/// number of documents in the collection, it is undefined which documents are /// number of documents in the collection, it is undefined which documents are
/// removed. /// removed.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.removeByExample({ "domain": "de.celler" }) /// arangod> db.content.removeByExample({ "domain": "de.celler" })
@ -899,35 +899,35 @@ ArangoCollection.prototype.removeByExample = function (example, waitForSync, lim
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief replaces documents matching an example /// @brief replaces documents matching an example
/// /// @startDocuBlock documents_collectionReplaceByExample
/// @FUN{@FA{collection}.replaceByExample(@FA{example}, @FA{newValue})} /// `collection.replaceByExample(example, newValue)`
/// ///
/// Replaces all documents matching an example with a new document body. /// Replaces all documents matching an example with a new document body.
/// The entire document body of each document matching the @FA{example} will be /// The entire document body of each document matching the *example* will be
/// replaced with @FA{newValue}. The document meta-attributes such as @LIT{_id}, /// replaced with *newValue*. The document meta-attributes such as *_id*,
/// @LIT{_key}, @LIT{_from}, @LIT{_to} will not be replaced. /// *_key*, *_from*, *_to* will not be replaced.
/// ///
/// @FUN{@FA{collection}.replaceByExample(@FA{document}, @FA{newValue}, @FA{waitForSync})} /// `collection.replaceByExample(document, newValue, waitForSync)`
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronisation
/// of the document replacement operation to disk even in case that the /// of the document replacement operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.replaceByExample(@FA{document}, @FA{newValue}, @FA{waitForSync}, @FA{limit})} /// `collection.replaceByExample(document, newValue, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// replacements to the specified value. If @FA{limit} is specified but less than /// replacements to the specified value. If *limit* is specified but less than
/// the number of documents in the collection, it is undefined which documents are /// the number of documents in the collection, it is undefined which documents are
/// replaced. /// replaced.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.replaceByExample({ "domain": "de.celler" }, { "foo": "someValue }, false, 5) /// arangod> db.content.replaceByExample({ "domain": "de.celler" }, { "foo": "someValue }, false, 5)
@ -940,42 +940,42 @@ ArangoCollection.prototype.replaceByExample = function (example, newValue, waitF
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief partially updates documents matching an example /// @brief partially updates documents matching an example
/// /// @startDocuBlock documents_collectionUpdateByExample
/// @FUN{@FA{collection}.updateByExample(@FA{example}, @FA{newValue})} /// `collection.updateByExample(example, newValue`
/// ///
/// Partially updates all documents matching an example with a new document body. /// Partially updates all documents matching an example with a new document body.
/// Specific attributes in the document body of each document matching the /// Specific attributes in the document body of each document matching the
/// @FA{example} will be updated with the values from @FA{newValue}. /// *example* will be updated with the values from *newValue*.
/// The document meta-attributes such as @LIT{_id}, @LIT{_key}, @LIT{_from}, /// The document meta-attributes such as *_id*, *_key*, *_from*,
/// @LIT{_to} cannot be updated. /// *_to* cannot be updated.
/// ///
/// @FUN{@FA{collection}.updateByExample(@FA{document}, @FA{newValue}, @FA{keepNull}, @FA{waitForSync})} /// `collection.updateByExample(document, newValue, keepNull, waitForSync)`
/// ///
/// The optional @FA{keepNull} parameter can be used to modify the behavior when /// The optional *keepNull* parameter can be used to modify the behavior when
/// handling @LIT{null} values. Normally, @LIT{null} values are stored in the /// handling *null* values. Normally, *null* values are stored in the
/// database. By setting the @FA{keepNull} parameter to @LIT{false}, this behavior /// database. By setting the *keepNull* parameter to *false*, this behavior
/// can be changed so that all attributes in @FA{data} with @LIT{null} values will /// can be changed so that all attributes in *data* with *null* values will
/// be removed from the target document. /// be removed from the target document.
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronization
/// of the document replacement operation to disk even in case that the /// of the document replacement operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.updateByExample(@FA{document}, @FA{newValue}, @FA{keepNull}, @FA{waitForSync}, @FA{limit})} /// `collection.updateByExample(document, newValue, keepNull, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// updates to the specified value. If @FA{limit} is specified but less than /// updates to the specified value. If *limit* is specified but less than
/// the number of documents in the collection, it is undefined which documents are /// the number of documents in the collection, it is undefined which documents are
/// updated. /// updated.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.updateByExample({ "domain": "de.celler" }, { "foo": "someValue, "domain": null }, false) /// arangod> db.content.updateByExample({ "domain": "de.celler" }, { "foo": "someValue, "domain": null }, false)

View File

@ -31,10 +31,9 @@ var fs = require("fs");
var printf = internal.printf; var printf = internal.printf;
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
/// @addtogroup ArangoDB // --SECTION-- private functions
/// @{ // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief unload a collection /// @brief unload a collection
@ -589,9 +588,9 @@ function main (argv) {
} }
} }
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
/// @} // --SECTION-- END-OF-FILE
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "ApplicationFeature.h" #include "ApplicationFeature.h"
@ -35,17 +35,12 @@ using namespace std;
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ApplicationFeature::ApplicationFeature (string const& name) ApplicationFeature::ApplicationFeature (string const& name)
: _name(name) { : _disabled(false), _name(name) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -55,19 +50,10 @@ ApplicationFeature::ApplicationFeature (string const& name)
ApplicationFeature::~ApplicationFeature () { ApplicationFeature::~ApplicationFeature () {
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief returns the name /// @brief returns the name
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -146,9 +132,17 @@ void ApplicationFeature::stop () {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @brief disable feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationFeature::disable () {
_disabled = true;
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}" // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_APPLICATION_SERVER_APPLICATION_FEATURE_H #ifndef TRIAGENS_APPLICATION_SERVER_APPLICATION_FEATURE_H
@ -45,11 +45,6 @@ namespace triagens {
// --SECTION-- class ApplicationFeature // --SECTION-- class ApplicationFeature
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
namespace rest { namespace rest {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -61,19 +56,10 @@ namespace triagens {
ApplicationFeature (ApplicationFeature const&); ApplicationFeature (ApplicationFeature const&);
ApplicationFeature& operator= (ApplicationFeature const&); ApplicationFeature& operator= (ApplicationFeature const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -88,19 +74,10 @@ namespace triagens {
virtual ~ApplicationFeature (); virtual ~ApplicationFeature ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -169,18 +146,27 @@ namespace triagens {
virtual void stop (); virtual void stop ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @brief disable feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void disable ();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- protected variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
protected:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer /// @brief feature is disabled
/// @{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool _disabled;
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
private: private:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -192,10 +178,6 @@ namespace triagens {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -172,6 +172,10 @@ void ApplicationDispatcher::setupOptions (map<string, ProgramOptionsDescription>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::prepare () { bool ApplicationDispatcher::prepare () {
if (_disabled) {
return true;
}
buildDispatcher(_applicationScheduler->scheduler()); buildDispatcher(_applicationScheduler->scheduler());
return true; return true;
@ -182,6 +186,10 @@ bool ApplicationDispatcher::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::start () { bool ApplicationDispatcher::start () {
if (_disabled) {
return true;
}
buildDispatcherReporter(); buildDispatcherReporter();
bool ok = _dispatcher->start(); bool ok = _dispatcher->start();
@ -203,6 +211,10 @@ bool ApplicationDispatcher::start () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::open () { bool ApplicationDispatcher::open () {
if (_disabled) {
return true;
}
if (_dispatcher != 0) { if (_dispatcher != 0) {
return _dispatcher->open(); return _dispatcher->open();
} }
@ -215,6 +227,10 @@ bool ApplicationDispatcher::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationDispatcher::close () { void ApplicationDispatcher::close () {
if (_disabled) {
return;
}
if (_dispatcher != 0) { if (_dispatcher != 0) {
_dispatcher->beginShutdown(); _dispatcher->beginShutdown();
} }
@ -225,6 +241,10 @@ void ApplicationDispatcher::close () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationDispatcher::stop () { void ApplicationDispatcher::stop () {
if (_disabled) {
return;
}
if (_dispatcherReporterTask != 0) { if (_dispatcherReporterTask != 0) {
_dispatcherReporterTask = 0; _dispatcherReporterTask = 0;
} }

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "ApplicationEndpointServer.h" #include "ApplicationEndpointServer.h"
@ -70,11 +70,6 @@ namespace {
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Scheduler
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -137,19 +132,10 @@ ApplicationEndpointServer::~ApplicationEndpointServer () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Scheduler
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief builds the endpoint servers /// @brief builds the endpoint servers
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -193,19 +179,10 @@ bool ApplicationEndpointServer::buildServers () {
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc} /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -543,6 +520,10 @@ const std::vector<std::string> ApplicationEndpointServer::getEndpointMapping (st
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::prepare () { bool ApplicationEndpointServer::prepare () {
if (_disabled) {
return true;
}
loadEndpoints(); loadEndpoints();
if (_endpointList.empty()) { if (_endpointList.empty()) {
@ -569,6 +550,10 @@ bool ApplicationEndpointServer::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::prepare2 () { bool ApplicationEndpointServer::prepare2 () {
if (_disabled) {
return true;
}
// scheduler might be created after prepare(), so we need to use prepare2()!! // scheduler might be created after prepare(), so we need to use prepare2()!!
Scheduler* scheduler = _applicationScheduler->scheduler(); Scheduler* scheduler = _applicationScheduler->scheduler();
@ -586,6 +571,10 @@ bool ApplicationEndpointServer::prepare2 () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::open () { bool ApplicationEndpointServer::open () {
if (_disabled) {
return true;
}
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -600,6 +589,10 @@ bool ApplicationEndpointServer::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationEndpointServer::close () { void ApplicationEndpointServer::close () {
if (_disabled) {
return;
}
// close all open connections // close all open connections
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -620,6 +613,10 @@ void ApplicationEndpointServer::close () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationEndpointServer::stop () { void ApplicationEndpointServer::stop () {
if (_disabled) {
return;
}
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -627,19 +624,10 @@ void ApplicationEndpointServer::stop () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private methods // --SECTION-- private methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief creates an ssl context /// @brief creates an ssl context
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -748,10 +736,6 @@ bool ApplicationEndpointServer::createSslContext () {
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_HTTP_SERVER_APPLICATION_ENDPOINT_SERVER_H #ifndef TRIAGENS_HTTP_SERVER_APPLICATION_ENDPOINT_SERVER_H
@ -52,11 +52,6 @@ namespace triagens {
// --SECTION-- class ApplicationEndpointServer // --SECTION-- class ApplicationEndpointServer
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief application http server feature /// @brief application http server feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -66,19 +61,10 @@ namespace triagens {
ApplicationEndpointServer (ApplicationEndpointServer const&); ApplicationEndpointServer (ApplicationEndpointServer const&);
ApplicationEndpointServer& operator= (ApplicationEndpointServer const&); ApplicationEndpointServer& operator= (ApplicationEndpointServer const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -99,19 +85,10 @@ namespace triagens {
~ApplicationEndpointServer (); ~ApplicationEndpointServer ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -136,19 +113,10 @@ namespace triagens {
_basePath = basePath; _basePath = basePath;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc} /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -230,19 +198,10 @@ namespace triagens {
void stop (); void stop ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private methods // --SECTION-- private methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
private: private:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -257,19 +216,10 @@ namespace triagens {
bool createSslContext (); bool createSslContext ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- protected variables // --SECTION-- protected variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
protected: protected:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -630,10 +580,6 @@ namespace triagens {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -461,6 +461,10 @@ bool ApplicationScheduler::parsePhase2 (triagens::basics::ProgramOptions& option
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::prepare () { bool ApplicationScheduler::prepare () {
if (_disabled) {
return true;
}
buildScheduler(); buildScheduler();
return true; return true;
@ -471,6 +475,10 @@ bool ApplicationScheduler::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::start () { bool ApplicationScheduler::start () {
if (_disabled) {
return true;
}
buildSchedulerReporter(); buildSchedulerReporter();
buildControlCHandler(); buildControlCHandler();
@ -498,6 +506,10 @@ bool ApplicationScheduler::start () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::open () { bool ApplicationScheduler::open () {
if (_disabled) {
return true;
}
if (_scheduler != 0) { if (_scheduler != 0) {
return _scheduler->open(); return _scheduler->open();
} }
@ -510,6 +522,10 @@ bool ApplicationScheduler::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationScheduler::stop () { void ApplicationScheduler::stop () {
if (_disabled) {
return;
}
if (_scheduler != 0) { if (_scheduler != 0) {
static size_t const MAX_TRIES = 10; static size_t const MAX_TRIES = 10;