1
0
Fork 0

use method

This commit is contained in:
jsteemann 2016-04-27 13:08:24 +02:00
parent 7472aca387
commit 22a1c0bb08
9 changed files with 26 additions and 28 deletions

View File

@ -55,8 +55,8 @@ void ActionFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
void ActionFeature::start() { void ActionFeature::start() {
ACTION = this; ACTION = this;
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>( V8DealerFeature* dealer =
ApplicationServer::lookupFeature("V8Dealer")); ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
if (dealer != nullptr) { if (dealer != nullptr) {
dealer->defineContextUpdate( dealer->defineContextUpdate(

View File

@ -159,8 +159,8 @@ void AgencyFeature::start() {
std::string endpoint; std::string endpoint;
std::string port = "8529"; std::string port = "8529";
EndpointFeature* endpointFeature = dynamic_cast<EndpointFeature*>( EndpointFeature* endpointFeature =
ApplicationServer::lookupFeature("Endpoint")); ApplicationServer::getFeature<EndpointFeature>("Endpoint");
auto endpoints = endpointFeature->httpEndpoints(); auto endpoints = endpointFeature->httpEndpoints();
if (!endpoints.empty()) { if (!endpoints.empty()) {

View File

@ -199,8 +199,8 @@ void ClusterFeature::prepare() {
// create an instance (this will not yet create a thread) // create an instance (this will not yet create a thread)
ClusterComm::instance(); ClusterComm::instance();
AgencyFeature* agency = dynamic_cast<AgencyFeature*>( AgencyFeature* agency =
application_features::ApplicationServer::lookupFeature("Agency")); application_features::ApplicationServer::getFeature<AgencyFeature>("Agency");
if (agency->isEnabled() || _enableCluster) { if (agency->isEnabled() || _enableCluster) {
// initialize ClusterComm library, must call initialize only once // initialize ClusterComm library, must call initialize only once
@ -455,8 +455,8 @@ void ClusterFeature::start() {
ServerState::instance()->setState(ServerState::STATE_SYNCING); ServerState::instance()->setState(ServerState::STATE_SYNCING);
} }
DispatcherFeature* dispatcher = dynamic_cast<DispatcherFeature*>( DispatcherFeature* dispatcher =
ApplicationServer::lookupFeature("Dispatcher")); ApplicationServer::getFeature<DispatcherFeature>("Dispatcher");
dispatcher->buildAqlQueue(); dispatcher->buildAqlQueue();
} }

View File

@ -94,14 +94,12 @@ void ServerJob::cleanup(DispatcherQueue* queue) {
bool ServerJob::execute() { bool ServerJob::execute() {
// default to system database // default to system database
DatabaseFeature* database = dynamic_cast<DatabaseFeature*>( DatabaseFeature* database =
ApplicationServer::lookupFeature("Database")); ApplicationServer::getFeature<DatabaseFeature>("Database");
TRI_vocbase_t* const vocbase = database->vocbase(); TRI_vocbase_t* const vocbase = database->vocbase();
if (vocbase == nullptr) { if (vocbase == nullptr) {
std::cout << "+++++++++++++ oops ++++++++++++++" << std::endl;
// database is gone // database is gone
return false; return false;
} }

View File

@ -235,8 +235,8 @@ void DatabaseFeature::openDatabases() {
defaults.forceSyncProperties = _forceSyncProperties; defaults.forceSyncProperties = _forceSyncProperties;
// get authentication (if available) // get authentication (if available)
RestServerFeature* rest = dynamic_cast<RestServerFeature*>( RestServerFeature* rest =
ApplicationServer::lookupFeature("RestServer")); ApplicationServer::getFeature<RestServerFeature>("RestServer");
if (rest != nullptr) { if (rest != nullptr) {
defaults.requireAuthentication = rest->authentication(); defaults.requireAuthentication = rest->authentication();

View File

@ -146,8 +146,8 @@ void FileDescriptorsFeature::adjustFileDescriptors() {
} }
// the select backend has more restrictions // the select backend has more restrictions
SchedulerFeature* scheduler = dynamic_cast<SchedulerFeature*>( SchedulerFeature* scheduler =
ApplicationServer::lookupFeature("Scheduler")); ApplicationServer::getFeature<SchedulerFeature>("Scheduler");
if (scheduler != nullptr && scheduler->backend() == 1) { if (scheduler != nullptr && scheduler->backend() == 1) {
if (FD_SETSIZE < _descriptorsMinimum) { if (FD_SETSIZE < _descriptorsMinimum) {

View File

@ -851,8 +851,8 @@ V8Context* V8DealerFeature::pickFreeContextForGc() {
void V8DealerFeature::initializeContext(size_t i) { void V8DealerFeature::initializeContext(size_t i) {
CONDITION_LOCKER(guard, _contextCondition); CONDITION_LOCKER(guard, _contextCondition);
V8PlatformFeature* v8platform = dynamic_cast<V8PlatformFeature*>( V8PlatformFeature* v8platform =
application_features::ApplicationServer::lookupFeature("V8Platform")); application_features::ApplicationServer::getFeature<V8PlatformFeature>("V8Platform");
TRI_ASSERT(v8platform != nullptr); TRI_ASSERT(v8platform != nullptr);
v8::Isolate::CreateParams createParams; v8::Isolate::CreateParams createParams;

View File

@ -509,8 +509,8 @@ static int OpenDatabases(TRI_server_t* server, bool isUpgrade) {
// create app directories // create app directories
// ......................................................................... // .........................................................................
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>( V8DealerFeature* dealer =
ApplicationServer::lookupFeature("V8Dealer")); ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath()); auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
res = CreateApplicationDirectory(databaseName.c_str(), appPath.c_str()); res = CreateApplicationDirectory(databaseName.c_str(), appPath.c_str());
@ -1028,8 +1028,8 @@ static void DatabaseManager(void* data) {
<< "'"; << "'";
// remove apps directory for database // remove apps directory for database
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>( V8DealerFeature* dealer =
ApplicationServer::lookupFeature("V8Dealer")); ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath()); auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
if (database->_isOwnAppsDirectory && !appPath.empty()) { if (database->_isOwnAppsDirectory && !appPath.empty()) {
@ -1305,8 +1305,8 @@ int TRI_StartServer(TRI_server_t* server, bool checkVersion,
// create shared application directories // create shared application directories
// ........................................................................... // ...........................................................................
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>( V8DealerFeature* dealer =
ApplicationServer::lookupFeature("V8Dealer")); ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath()); auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
if (!appPath.empty() && !TRI_IsDirectory(appPath.c_str())) { 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 // create application directories
V8DealerFeature* dealer = dynamic_cast<V8DealerFeature*>( V8DealerFeature* dealer =
ApplicationServer::lookupFeature("V8Dealer")); ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
auto appPath = (dealer == nullptr ? std::string() : dealer->appPath()); auto appPath = (dealer == nullptr ? std::string() : dealer->appPath());
CreateApplicationDirectory(vocbase->_name, appPath.c_str()); CreateApplicationDirectory(vocbase->_name, appPath.c_str());

View File

@ -131,8 +131,8 @@ void ClientFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
!options->processingResult().touched(_section + ".password")) { !options->processingResult().touched(_section + ".password")) {
usleep(10 * 1000); usleep(10 * 1000);
ConsoleFeature* console = dynamic_cast<ConsoleFeature*>( ConsoleFeature* console =
ApplicationServer::lookupFeature("Console")); ApplicationServer::getFeature<ConsoleFeature>("Console");
if (console != nullptr) { if (console != nullptr) {
_password = console->readPassword("Please specify a password: "); _password = console->readPassword("Please specify a password: ");