Provides per-database configuration from databases.conf.
| 534 | |
| 535 | // Provides per-database configuration from databases.conf. |
| 536 | class FactoryParameter final : |
| 537 | public RefCntIface<IPluginConfigImpl<FactoryParameter, CheckStatusWrapper> > |
| 538 | { |
| 539 | public: |
| 540 | FactoryParameter(ConfiguredPlugin* cp, IFirebirdConf* fc) |
| 541 | : configuredPlugin(cp), firebirdConf(fc) |
| 542 | { } |
| 543 | |
| 544 | // IPluginConfig implementation |
| 545 | const char* getConfigFileName() |
| 546 | { |
| 547 | return configuredPlugin->getConfigFileName(); |
| 548 | } |
| 549 | |
| 550 | IConfig* getDefaultConfig(CheckStatusWrapper* status) |
| 551 | { |
| 552 | try |
| 553 | { |
| 554 | return configuredPlugin->getDefaultConfig(); |
| 555 | } |
| 556 | catch (const Exception& ex) |
| 557 | { |
| 558 | ex.stuffException(status); |
| 559 | return NULL; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | IFirebirdConf* getFirebirdConf(CheckStatusWrapper* status) |
| 564 | { |
| 565 | try |
| 566 | { |
| 567 | if (!firebirdConf.hasData()) |
| 568 | { |
| 569 | RefPtr<const Config> specificConf(Config::getDefaultConfig()); |
| 570 | firebirdConf = FB_NEW FirebirdConf(specificConf); |
| 571 | } |
| 572 | |
| 573 | firebirdConf->addRef(); |
| 574 | return firebirdConf; |
| 575 | } |
| 576 | catch (const Exception& ex) |
| 577 | { |
| 578 | ex.stuffException(status); |
| 579 | return NULL; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | void setReleaseDelay(CheckStatusWrapper*, ISC_UINT64 microSeconds) |
| 584 | { |
| 585 | configuredPlugin->setReleaseDelay(microSeconds); |
| 586 | } |
| 587 | |
| 588 | private: |
| 589 | ~FactoryParameter() |
| 590 | { |
| 591 | #ifdef DEBUG_PLUGINS |
| 592 | fprintf(stderr, "~FactoryParameter places configuredPlugin %s in unload query for %lld seconds\n", |
| 593 | configuredPlugin->getPlugName(), configuredPlugin->getReleaseDelay() / 1000000); |