本文整理汇总了C++中ice::PropertiesPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PropertiesPtr类的具体用法?C++ PropertiesPtr怎么用?C++ PropertiesPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertiesPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]){
Ice::CommunicatorPtr ic = EasyIce::initialize(argc, argv);
Ice::PropertiesPtr prop = ic->getProperties();
prop->setProperty("Test.Adapter.Endpoints", "tcp -h localhost -p 65000");
Ice::ObjectPtr obj = new IceMX::Metrics();
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapter("Test.Adapter");
adapter->add(obj, ic->stringToIdentity("metric"));
std::cout<<"\n### EXAMPLE with easyiceconfig::proxies::createProxy() ###"<<std::endl;
/// Exception due empty proxy
try{
easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "Test.Proxy", false);
} catch (Ice::ProxyParseException ex){
std::cout<<"Expected ProxyParseException\n"<<ex<<std::endl;
}
IceMX::MetricsPrx pxr;
/// All ok (1)
/// Proxy from string do not create entry at Properties
pxr = easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "metric:tcp -h localhost -p 65000", true);
easyiceconfig::debug::printProperties(prop);
/// All ok (2)
prop->setProperty("Test.Proxy", "metric:tcp -h localhost -p 65000");
pxr = easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "Test.Proxy", false);
easyiceconfig::debug::printProperties(prop);
// Using it
std::cout << "Gathering some info" << std::endl;
std::cout << pxr->ice_id() << std::endl;
std::cout << pxr->ice_toString() << std::endl;
std::cout<<"\n### EXAMPLE with EasyIce::EasyProxy ###"<<std::endl;
EasyIce::EasyProxy<IceMX::MetricsPrx> proxy(ic, "bad endpoint definition", true);
if (proxy){
//do stuff
}else
std::cout<<proxy.exception()<<std::endl;
// copying
EasyIce::EasyProxy<IceMX::MetricsPrx> p2;
p2 = EasyIce::EasyProxy<IceMX::MetricsPrx>(ic, "bad endpoint definition", true);
try{
p2 = EasyIce::createProxy<IceMX::MetricsPrx>(ic, "bad endpoint definition", true);
}catch(Ice::Exception){}
ic->shutdown();
}
示例2: loadIceConfig
Ice::PropertiesPtr
initializeProperties(Ice::StringSeq args, Ice::PropertiesPtr properties){
properties->parseIceCommandLineOptions(args);
std::string iceconfigs = properties->getProperty("Ice.Config");
if (!iceconfigs.empty()){
for (std::string iceconfig : std::split(iceconfigs, ","))
loadIceConfig(iceconfig, properties);
}
properties->parseCommandLineOptions("", args);
return properties;
}
示例3: appName
int
LibraryServer::run(int argc, char*[])
{
if(argc > 1)
{
cerr << appName() << ": too many arguments" << endl;
return EXIT_FAILURE;
}
Ice::PropertiesPtr properties = communicator()->getProperties();
//
// Create an object adapter
//
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Library");
//
// Create an evictor for books.
//
Freeze::EvictorPtr evictor = Freeze::createBackgroundSaveEvictor(adapter, _envName, "books");
Ice::Int evictorSize = properties->getPropertyAsInt("EvictorSize");
if(evictorSize > 0)
{
evictor->setSize(evictorSize);
}
//
// Use the evictor as servant Locator.
//
adapter->addServantLocator(evictor, "book");
//
// Create the library, and add it to the object adapter.
//
LibraryIPtr library = new LibraryI(communicator(), _envName, "authors", evictor);
adapter->add(library, Ice::stringToIdentity("library"));
//
// Create and install a factory for books.
//
Ice::ValueFactoryPtr bookFactory = new BookFactory(library);
communicator()->getValueFactoryManager()->add(bookFactory, Demo::Book::ice_staticId());
//
// Everything ok, let's go.
//
shutdownOnInterrupt();
adapter->activate();
communicator()->waitForShutdown();
ignoreInterrupt();
return EXIT_SUCCESS;
}
示例4: main
int main(int argc, char** argv){
killed=false;
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = exitApplication;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
Ice::PropertiesPtr prop;
std::string componentPrefix("myComponent");
try{
ic = Ice::initialize(argc,argv);
prop = ic->getProperties();
}
catch (const Ice::Exception& ex) {
std::cerr << ex << std::endl;
return 1;
}
catch (const char* msg) {
std::cerr <<"Error :" << msg << std::endl;
return 1;
}
std::string Endpoints = prop->getProperty(componentPrefix + ".Endpoints");
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints(componentPrefix, Endpoints);
// for each interface:
std::string objPrefix="myInterface";
std::string Name = "pointcloud1";
std::cout << "Creating pointcloud1 " << Name << std::endl;
interface1 = new myClassI();
adapter->add(interface1, ic->stringToIdentity(Name));
//starting the adapter
adapter->activate();
ic->waitForShutdown();
if (!killed)
exitApplication(1);
return 0;
}
示例5: initialize
void MyUtil::initialize() {
ServiceI& service = ServiceI::instance();
Ice::PropertiesPtr props = service.getCommunicator()->getProperties();
// service.getObjectCache()->registerCategory(kUserPageCacheIndex, "USER_PAGE", new UserPageFactoryI, props, true);
service.getAdapter()->add(&PageCacheManagerI::instance(), service.createIdentity("M", ""));
InitMonitorLogger(ServiceI::instance().getName(), "monitor", "../log/" + ServiceI::instance().getName() + "/monitor/monitor_log", "INFO");
string fcgi_socket = props->getPropertyWithDefault("Service." + service.getName() + ".FcgiSocket", "0.0.0.0:9001");
MCE_INFO("Fcgi listens on : " << fcgi_socket);
FcgiServer * fcgi_server = new FcgiServer(fcgi_socket, 128);
fcgi_server->RegisterRequestFactory(new PageCacheRequestFactory());
fcgi_server->Start();
}
示例6: initialize
void MyUtil::initialize() {
ServiceI& service = ServiceI::instance();
service.getAdapter()->add(&xce::ad::AdUnionAdminI::instance(),
service.createIdentity("M", ""));
Ice::PropertiesPtr props = service.getCommunicator()->getProperties();
string fcgi_socket = props->getPropertyWithDefault("Service." + service.getName() + ".FcgiSocket", "0.0.0.0:9001");
MCE_INFO("Fcgi listens on : " << fcgi_socket);
FcgiServer * fcgi_server = new FcgiServer(fcgi_socket, 4);
fcgi_server->RegisterRequestFactory(new xce::ad::AdminRequestFactory());
fcgi_server->Start();
}
示例7: CheckerTimerTask
UserFeedsI::UserFeedsI() {
ServiceI& service = ServiceI::instance();
Ice::PropertiesPtr props = service.getCommunicator()->getProperties();
checker_limit_ = ITEM_COUNT_LIMIT;
checker_interval_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".CheckerInterval", 10);
build_history_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".BuildHistory", 1);//单位为天 15->1
build_interval_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".BuildInterval", 20);//单位为分钟
checker_ = new CheckerTimerTask(fs_, checker_limit_);
timer_.scheduleRepeated(checker_, IceUtil::Time::seconds(checker_interval_));
}
示例8: ThrowerI
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
properties->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new ThrowerI();
adapter->add(object, communicator->stringToIdentity("thrower"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例9: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
properties->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + " -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("Test"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例10: main
int main(int argc, char* argv[]) {
if (argc < 3) {
cerr << "tmcli <endpoint> <command> ..." << endl;
return -1;
}
try {
Ice::PropertiesPtr properties = Ice::createProperties();
properties->load("../etc/admin.cfg");
InitializationData initializationData;
initializationData.properties = properties;
CommunicatorPtr communicator = initialize(initializationData);
ObjectPrx object = communicator->stringToProxy("[email protected]"+string(argv[1]));
TaskManagerAPIPrx manager = TaskManagerAPIPrx::uncheckedCast(object);
if (string(argv[2]) == "clear") {
if (argc != 4) {
help();
return -1;
}
int level = boost::lexical_cast<int>(argv[3]);
manager->clear(level);
} else if (string(argv[2]) == "size") {
if (argc != 4) {
help();
return -1;
}
int level = boost::lexical_cast<int>(argv[3]);
cout << manager->size(level) << endl;
} else if (string(argv[2]) == "config") {
if (argc != 7) {
help();
return -1;
}
int level = boost::lexical_cast<int>(argv[3]);
int min = boost::lexical_cast<int>(argv[4]);
int max = boost::lexical_cast<int>(argv[5]);
int stack = boost::lexical_cast<int>(argv[6]);
manager->config(level, min, max, stack);
} else {
help();
}
} catch (const Ice::Exception& e) {
cerr << e.what() << endl;
return -1;
} catch (...) {
cerr << "unknown exception" << endl;
return -1;
}
return 0;
}
示例11: main
int main(int argc, char** argv)
{
Ice::ObjectPtr viewerPtr;
//signal(SIGINT,signalHandler);
Ice::CommunicatorPtr ic;
try{
ic = EasyIce::initialize(argc, argv);
Ice::PropertiesPtr prop = ic->getProperties();
std::string Endpoints = prop->getProperty("Visualization.Endpoints");
// Naming Service
int nsActive = prop->getPropertyAsIntWithDefault("NamingService.Enabled", 0);
if (nsActive)
{
std::string ns_proxy = prop->getProperty("NamingService.Proxy");
try
{
namingService = new jderobot::ns(ic, ns_proxy);
}
catch (Ice::ConnectionRefusedException& ex)
{
jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
exit(-1);
}
}
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints("Visualization", Endpoints);
std::string objPrefix("Visualization.");
std::string viewerName = prop->getProperty(objPrefix + "Name");
Ice::ObjectPtr object = new visualization::VisualizationI(objPrefix, ic);
adapter->add(object, ic->stringToIdentity(viewerName));
if (namingService)
namingService->bind(viewerName, Endpoints, object->ice_staticId());
adapter->activate();
ic->waitForShutdown();
}catch (const Ice::Exception& ex) {
std::cerr << ex<<" 1 " << std::endl;
exit(-1);
} catch (const char* msg) {
std::cerr << msg<< " 2 " << std::endl;
exit(-1);
}
}
示例12:
void
ControllerI::activateObjectAdapter(const string& name,
const string& adapterId,
const string& replicaGroupId,
const Ice::Current& current)
{
Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
Ice::PropertiesPtr properties = communicator->getProperties();
properties->setProperty(name + ".AdapterId", adapterId);
properties->setProperty(name + ".ReplicaGroupId", replicaGroupId);
properties->setProperty(name + ".Endpoints", "default");
_adapters[name] = communicator->createObjectAdapter(name);
_adapters[name]->activate();
}
示例13: SessionServantManager
Ice::ObjectAdapterPtr
RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, const IceGrid::LocatorPrx& locator)
{
Ice::PropertiesPtr properties = _communicator->getProperties();
Ice::ObjectAdapterPtr adapter;
SessionServantManagerPtr servantManager;
if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
{
adapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager");
servantManager = new SessionServantManager(adapter, _instanceName, false, "", 0, 0);
adapter->addServantLocator(servantManager, "");
}
assert(_reaper);
_timer = new IceUtil::Timer(); // Used for for session allocation timeout.
_clientSessionFactory = new ClientSessionFactory(servantManager, _database, _timer, _reaper);
if(servantManager && _master) // Slaves don't support client session manager objects.
{
Identity sessionMgrId;
sessionMgrId.category = _instanceName;
sessionMgrId.name = "SessionManager";
Identity sslSessionMgrId;
sslSessionMgrId.category = _instanceName;
sslSessionMgrId.name = "SSLSessionManager";
adapter->add(new ClientSessionManagerI(_clientSessionFactory), sessionMgrId);
adapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslSessionMgrId);
_wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId());
_wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId());
}
if(adapter)
{
Ice::Identity dummy;
dummy.name = "dummy";
_wellKnownObjects->addEndpoint("SessionManager", adapter->createDirectProxy(dummy));
}
_clientVerifier = getPermissionsVerifier(registryAdapter,
locator,
"IceGrid.Registry.PermissionsVerifier",
properties->getProperty("IceGrid.Registry.CryptPasswords"));
_sslClientVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.SSLPermissionsVerifier");
return adapter;
}
示例14:
FrequencyAnalyzer::FrequencyAnalyzer() :
Analyzer() {
ServiceI& service = ServiceI::instance();
Ice::PropertiesPtr prop = service.getCommunicator()->getProperties();
_configMap = prop->getPropertiesForPrefix("FrequencyAnalyzer");
/*stringstream stream(prop->getProperty("Mobile"));
string mobile;
while (stream >> mobile) {
_alert->addMobile(mobile);
}*/
_time = prop->getPropertyAsIntWithDefault("FrequencyAnalyzer.Time", 60);
_size = prop->getPropertyAsIntWithDefault("FrequencyAnalyzer.Size", 6);
}
示例15: createTestProperties
void
ServerAMD::run(int argc, char** argv)
{
Ice::PropertiesPtr properties = createTestProperties(argc, argv);
#ifndef ICE_CPP11_MAPPING
properties->setProperty("Ice.CollectObjects", "1");
#endif
Ice::CommunicatorHolder communicator = initialize(argc, argv, properties);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(InitialI), Ice::stringToIdentity("initial"));
adapter->activate();
serverReady();
communicator->waitForShutdown();
}