本文整理汇总了C++中ice::CommunicatorPtr::getPluginManager方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr::getPluginManager方法的具体用法?C++ CommunicatorPtr::getPluginManager怎么用?C++ CommunicatorPtr::getPluginManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::CommunicatorPtr
的用法示例。
在下文中一共展示了CommunicatorPtr::getPluginManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp"));
communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter");
#ifdef ICE_CPP11_MAPPING
shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test"));
#else
PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get());
#endif
assert(plugin);
ConfigurationPtr configuration = plugin->getConfiguration();
BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration);
adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), communicator->stringToIdentity("background"));
adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), communicator->stringToIdentity("locator"));
adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), communicator->stringToIdentity("router"));
adapter->activate();
adapter2->add(backgroundController, communicator->stringToIdentity("backgroundController"));
adapter2->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例2: catch
//.........这里部分代码省略.........
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing a simple plug-in that fails to initialize... " << flush;
communicator = 0;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", "plugins/TestPlugin:createPluginInitializeFail");
communicator = Ice::initialize(argc, argv, initData);
test(false);
}
catch(const std::exception& ex)
{
test(string(ex.what()) == "PluginInitializeFailExeption");
}
test(!communicator);
cout << "ok" << endl;
cout << "testing plug-in load order... " << flush;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
communicator = Ice::initialize(argc, argv, initData);
communicator->destroy();
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing plug-in manager... " << flush;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
initData.properties->setProperty("Ice.InitPlugins", "0");
communicator = Ice::initialize(argc, argv, initData);
Ice::PluginManagerPtr pm = communicator->getPluginManager();
test(pm->getPlugin("PluginOne"));
test(pm->getPlugin("PluginTwo"));
test(pm->getPlugin("PluginThree"));
MyPluginPtr p4 = new MyPlugin;
pm->addPlugin("PluginFour", p4);
test(pm->getPlugin("PluginFour"));
pm->initializePlugins();
test(p4->isInitialized());
communicator->destroy();
test(p4->isDestroyed());
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing destroy when a plug-in fails to initialize... " << flush;
communicator = 0;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOneFail", "plugins/TestPlugin:createPluginOneFail");
initData.properties->setProperty("Ice.Plugin.PluginTwoFail", "plugins/TestPlugin:createPluginTwoFail");
initData.properties->setProperty("Ice.Plugin.PluginThreeFail", "plugins/TestPlugin:createPluginThreeFail");
initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOneFail, PluginTwoFail, PluginThreeFail");
communicator = Ice::initialize(argc, argv, initData);
test(false);
}
catch(const std::exception& ex)
{
test(string(ex.what()) == "PluginInitializeFailExeption");
}
test(!communicator);
cout << "ok" << endl;
return status;
}
示例3: catch
int
main(int argc, char* argv[])
{
int status = EXIT_SUCCESS;
Ice::CommunicatorPtr communicator;
cout << "testing a simple plug-in... " << flush;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test",
"plugins/TestPlugin:createPlugin 'C:\\Program Files\\' --DatabasePath "
"'C:\\Program Files\\Application\\db'" );
communicator = Ice::initialize(argc, argv, initData);
communicator->destroy();
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing a simple plug-in that fails to initialize... " << flush;
communicator = 0;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", "plugins/TestPlugin:createPluginInitializeFail");
communicator = Ice::initialize(argc, argv, initData);
test(false);
}
catch(const std::exception& ex)
{
test(string(ex.what()) == "PluginInitializeFailExeption");
}
test(!communicator);
cout << "ok" << endl;
cout << "testing plug-in load order... " << flush;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
communicator = Ice::initialize(argc, argv, initData);
communicator->destroy();
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing plug-in manager... " << flush;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
initData.properties->setProperty("Ice.InitPlugins", "0");
communicator = Ice::initialize(argc, argv, initData);
Ice::PluginManagerPtr pm = communicator->getPluginManager();
test(pm->getPlugin("PluginOne"));
test(pm->getPlugin("PluginTwo"));
test(pm->getPlugin("PluginThree"));
MyPluginPtr p4 = new MyPlugin;
pm->addPlugin("PluginFour", p4);
test(pm->getPlugin("PluginFour"));
pm->initializePlugins();
test(p4->isInitialized());
communicator->destroy();
test(p4->isDestroyed());
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing destroy when a plug-in fails to initialize... " << flush;
communicator = 0;
try
{
//.........这里部分代码省略.........