NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, NodeSessionManager& sessions, const ActivatorPtr& activator, const IceUtil::TimerPtr& timer, const TraceLevelsPtr& traceLevels, const NodePrx& proxy, const string& name, const UserAccountMapperPrx& mapper, const string& instanceName) : _communicator(adapter->getCommunicator()), _adapter(adapter), _sessions(sessions), _activator(activator), _timer(timer), _traceLevels(traceLevels), _name(name), _proxy(proxy), _redirectErrToOut(false), _allowEndpointsOverride(false), _waitTime(0), _instanceName(instanceName), _userAccountMapper(mapper), _platform("IceGrid.Node", _communicator, _traceLevels), _fileCache(new FileCache(_communicator)), _serial(1), _consistencyCheckDone(false) { Ice::PropertiesPtr props = _communicator->getProperties(); const_cast<string&>(_dataDir) = _platform.getDataDir(); const_cast<string&>(_serversDir) = _dataDir + "/servers"; const_cast<string&>(_tmpDir) = _dataDir + "/tmp"; const_cast<Ice::Int&>(_waitTime) = props->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60); const_cast<string&>(_outputDir) = props->getProperty("IceGrid.Node.Output"); const_cast<bool&>(_redirectErrToOut) = props->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0; const_cast<bool&>(_allowEndpointsOverride) = props->getPropertyAsInt("IceGrid.Node.AllowEndpointsOverride") > 0; // // Parse the properties override property. // vector<string> overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride"); if(!overrides.empty()) { for(vector<string>::iterator p = overrides.begin(); p != overrides.end(); ++p) { if(p->find("--") != 0) { *p = "--" + *p; } } Ice::PropertiesPtr p = Ice::createProperties(); p->parseCommandLineOptions("", overrides); Ice::PropertyDict propDict = p->getPropertiesForPrefix(""); for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q) { _propertiesOverride.push_back(createProperty(q->first, q->second)); } } }
RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter), _testIntf(TestIntfPrx::uncheckedCast(_adapter->add(new TestI(), adapter->getCommunicator()->stringToIdentity("test")))) { _adapter->activate(); }
int main(int argc, char *argv[]) { int status = 0; Ice::CommunicatorPtr ic; try { ic = Ice::initialize(argc, argv); Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints( "SimplePrinterAdapter", "default -p 10000"); Ice::ObjectPtr object = new PrinterI; adapter->add(object, adapter->getCommunicator()->stringToIdentity("SimplePrinter")); adapter->activate(); ic->waitForShutdown(); } catch (const Ice::Exception &e) { cerr << e << endl; status = 1; } catch (const char *msg) { cerr << msg << endl; status = 1; } if (ic) { try { ic->destroy(); } catch (const Ice::Exception &e) { cerr << e << endl; status = 1; } } return status; }