mirror of https://gitee.com/bigwinds/arangodb
use method
This commit is contained in:
parent
7472aca387
commit
22a1c0bb08
|
@ -55,8 +55,8 @@ void ActionFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
void ActionFeature::start() {
|
||||
ACTION = this;
|
||||
|
||||
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>(
|
||||
ApplicationServer::lookupFeature("V8Dealer"));
|
||||
V8DealerFeature* dealer =
|
||||
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
|
||||
|
||||
if (dealer != nullptr) {
|
||||
dealer->defineContextUpdate(
|
||||
|
|
|
@ -159,8 +159,8 @@ void AgencyFeature::start() {
|
|||
std::string endpoint;
|
||||
std::string port = "8529";
|
||||
|
||||
EndpointFeature* endpointFeature = dynamic_cast<EndpointFeature*>(
|
||||
ApplicationServer::lookupFeature("Endpoint"));
|
||||
EndpointFeature* endpointFeature =
|
||||
ApplicationServer::getFeature<EndpointFeature>("Endpoint");
|
||||
auto endpoints = endpointFeature->httpEndpoints();
|
||||
|
||||
if (!endpoints.empty()) {
|
||||
|
|
|
@ -199,8 +199,8 @@ void ClusterFeature::prepare() {
|
|||
// create an instance (this will not yet create a thread)
|
||||
ClusterComm::instance();
|
||||
|
||||
AgencyFeature* agency = dynamic_cast<AgencyFeature*>(
|
||||
application_features::ApplicationServer::lookupFeature("Agency"));
|
||||
AgencyFeature* agency =
|
||||
application_features::ApplicationServer::getFeature<AgencyFeature>("Agency");
|
||||
|
||||
if (agency->isEnabled() || _enableCluster) {
|
||||
// initialize ClusterComm library, must call initialize only once
|
||||
|
@ -455,8 +455,8 @@ void ClusterFeature::start() {
|
|||
ServerState::instance()->setState(ServerState::STATE_SYNCING);
|
||||
}
|
||||
|
||||
DispatcherFeature* dispatcher = dynamic_cast<DispatcherFeature*>(
|
||||
ApplicationServer::lookupFeature("Dispatcher"));
|
||||
DispatcherFeature* dispatcher =
|
||||
ApplicationServer::getFeature<DispatcherFeature>("Dispatcher");
|
||||
|
||||
dispatcher->buildAqlQueue();
|
||||
}
|
||||
|
|
|
@ -94,14 +94,12 @@ void ServerJob::cleanup(DispatcherQueue* queue) {
|
|||
bool ServerJob::execute() {
|
||||
// default to system database
|
||||
|
||||
DatabaseFeature* database = dynamic_cast<DatabaseFeature*>(
|
||||
ApplicationServer::lookupFeature("Database"));
|
||||
DatabaseFeature* database =
|
||||
ApplicationServer::getFeature<DatabaseFeature>("Database");
|
||||
|
||||
TRI_vocbase_t* const vocbase = database->vocbase();
|
||||
|
||||
if (vocbase == nullptr) {
|
||||
|
||||
std::cout << "+++++++++++++ oops ++++++++++++++" << std::endl;
|
||||
// database is gone
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -235,8 +235,8 @@ void DatabaseFeature::openDatabases() {
|
|||
defaults.forceSyncProperties = _forceSyncProperties;
|
||||
|
||||
// get authentication (if available)
|
||||
RestServerFeature* rest = dynamic_cast<RestServerFeature*>(
|
||||
ApplicationServer::lookupFeature("RestServer"));
|
||||
RestServerFeature* rest =
|
||||
ApplicationServer::getFeature<RestServerFeature>("RestServer");
|
||||
|
||||
if (rest != nullptr) {
|
||||
defaults.requireAuthentication = rest->authentication();
|
||||
|
|
|
@ -146,8 +146,8 @@ void FileDescriptorsFeature::adjustFileDescriptors() {
|
|||
}
|
||||
|
||||
// the select backend has more restrictions
|
||||
SchedulerFeature* scheduler = dynamic_cast<SchedulerFeature*>(
|
||||
ApplicationServer::lookupFeature("Scheduler"));
|
||||
SchedulerFeature* scheduler =
|
||||
ApplicationServer::getFeature<SchedulerFeature>("Scheduler");
|
||||
|
||||
if (scheduler != nullptr && scheduler->backend() == 1) {
|
||||
if (FD_SETSIZE < _descriptorsMinimum) {
|
||||
|
|
|
@ -851,8 +851,8 @@ V8Context* V8DealerFeature::pickFreeContextForGc() {
|
|||
void V8DealerFeature::initializeContext(size_t i) {
|
||||
CONDITION_LOCKER(guard, _contextCondition);
|
||||
|
||||
V8PlatformFeature* v8platform = dynamic_cast<V8PlatformFeature*>(
|
||||
application_features::ApplicationServer::lookupFeature("V8Platform"));
|
||||
V8PlatformFeature* v8platform =
|
||||
application_features::ApplicationServer::getFeature<V8PlatformFeature>("V8Platform");
|
||||
TRI_ASSERT(v8platform != nullptr);
|
||||
|
||||
v8::Isolate::CreateParams createParams;
|
||||
|
|
|
@ -509,8 +509,8 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
|
|||
// create app directories
|
||||
// .........................................................................
|
||||
|
||||
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>(
|
||||
ApplicationServer::lookupFeature("V8Dealer"));
|
||||
V8DealerFeature* dealer =
|
||||
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
|
||||
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
|
||||
|
||||
res = CreateApplicationDirectory(databaseName.c_str(), appPath.c_str());
|
||||
|
@ -1028,8 +1028,8 @@ static void DatabaseManager(void* data) {
|
|||
<< "'";
|
||||
|
||||
// remove apps directory for database
|
||||
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>(
|
||||
ApplicationServer::lookupFeature("V8Dealer"));
|
||||
V8DealerFeature* dealer =
|
||||
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
|
||||
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
|
||||
|
||||
if (database->_isOwnAppsDirectory && !appPath.empty()) {
|
||||
|
@ -1305,8 +1305,8 @@ int TRI_StartServer(TRI_server_t* server, bool checkVersion,
|
|||
// create shared application directories
|
||||
// ...........................................................................
|
||||
|
||||
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>(
|
||||
ApplicationServer::lookupFeature("V8Dealer"));
|
||||
V8DealerFeature* dealer =
|
||||
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
|
||||
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
|
||||
|
||||
if (!appPath.empty() && !TRI_IsDirectory(appPath.c_str())) {
|
||||
|
@ -1618,8 +1618,8 @@ int TRI_CreateDatabaseServer(TRI_server_t* server, TRI_voc_tick_t databaseId,
|
|||
}
|
||||
|
||||
// create application directories
|
||||
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>(
|
||||
ApplicationServer::lookupFeature("V8Dealer"));
|
||||
V8DealerFeature* dealer =
|
||||
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
|
||||
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
|
||||
|
||||
CreateApplicationDirectory(vocbase->_name, appPath.c_str());
|
||||
|
|
|
@ -131,8 +131,8 @@ void ClientFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
!options->processingResult().touched(_section + ".password")) {
|
||||
usleep(10 * 1000);
|
||||
|
||||
ConsoleFeature* console = dynamic_cast<ConsoleFeature*>(
|
||||
ApplicationServer::lookupFeature("Console"));
|
||||
ConsoleFeature* console =
|
||||
ApplicationServer::getFeature<ConsoleFeature>("Console");
|
||||
|
||||
if (console != nullptr) {
|
||||
_password = console->readPassword("Please specify a password: ");
|
||||
|
|
Loading…
Reference in New Issue