本文整理汇总了C++中ice::StringSeq类的典型用法代码示例。如果您正苦于以下问题:C++ StringSeq类的具体用法?C++ StringSeq怎么用?C++ StringSeq使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringSeq类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
StringSeq
AdminI::getAllRegistryNames(const Current&) const
{
Ice::StringSeq replicas = _database->getReplicaCache().getAll("");
replicas.push_back(_registry->getName());
return replicas;
}
开发者ID:zmyer,项目名称:ice,代码行数:7,代码来源:AdminI.cpp
示例2:
Ice::StringSeq
ReplicaGroupFilterI::filter(const string& /* replicaGroupId */,
const Ice::StringSeq& adapters,
const Ice::ConnectionPtr&,
const Ice::Context& ctx)
{
Ice::Context::const_iterator p = ctx.find("currency");
if(p == ctx.end())
{
return adapters;
}
string currency = p->second;
//
// Get the Currencies property value from the server descriptor
// that owns the adapter and only keep adapters for servers that
// are configured with the currency specified in the client
// context.
//
Ice::StringSeq filteredAdapters;
for(Ice::StringSeq::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
if(_facade->getPropertyForAdapter(*p, "Currencies").find(currency) != string::npos)
{
filteredAdapters.push_back(*p);
}
}
return filteredAdapters;
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:30,代码来源:RegistryPlugin.cpp
示例3: init
bool AgentAdapter::init(const ::Ice::StringSeq& defaultAgents,const bool is_udp_protocol, const bool is_compress)
{
if (defaultAgents.empty())
{
XLOG_ERROR("AgentAdapter::init defaultAgent is empty!");
return false;
}
srand(unsigned(time(NULL)));
Ice::PropertiesPtr props=Ice::createProperties();
props->setProperty("Ice.MessageSizeMax", ICE_MESSAGE_SIZE_MAX);
props->setProperty("Ice.Override.Timeout", ICE_TIMEOUT_MILLISECONDS);
Ice::InitializationData id;
id.properties=props;
_ic = ::Ice::initialize(id);
srand((unsigned) time(NULL));
current_agent_prx_number=0;
std::vector<slice::AgentPrx> _prxs;
for (::Ice::StringSeq::const_iterator it = defaultAgents.begin(); it != defaultAgents.end();
++it)
{
slice::AgentPrx prx = Util::getPrx<slice::AgentPrx>(_ic, *it, is_udp_protocol, 1000, is_compress);
_prxs.push_back(prx);
}
agent_prxs.swap(_prxs);
return true;
}
开发者ID:zhan8610189,项目名称:xlog,代码行数:30,代码来源:agent_adapter.cpp
示例4: in
int
main(int argc, char* argv[])
{
ifstream in("./config/configPath");
if(!in)
{
test(false);
}
if(!getline(in, configPath))
{
test(false);
}
try
{
cout << "testing load properties from UTF-8 path... " << flush;
Ice::PropertiesPtr properties = Ice::createProperties();
properties->load(configPath);
test(properties->getProperty("Ice.Trace.Network") == "1");
test(properties->getProperty("Ice.Trace.Protocol") == "1");
test(properties->getProperty("Config.Path") == configPath);
test(properties->getProperty("Ice.ProgramName") == "PropertiesClient");
cout << "ok" << endl;
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
cout << "testing load properties from UTF-8 path using Ice::Application... " << flush;
Client c;
c.main(argc, argv, configPath.c_str());
cout << "ok" << endl;
try
{
//
// Try to load multiple config files.
//
cout << "testing using Ice.Config with multiple config files... " << flush;
Ice::PropertiesPtr properties;
Ice::StringSeq args;
args.push_back("--Ice.Config=config/config.1, config/config.2, config/config.3");
IceUtilInternal::ArgVector a(args);
properties = Ice::createProperties(a.argc, a.argv);
test(properties->getProperty("Config1") == "Config1");
test(properties->getProperty("Config2") == "Config2");
test(properties->getProperty("Config3") == "Config3");
cout << "ok" << endl;
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:58,代码来源:Client.cpp
示例5: Connect
bool PSIDynamicICESender::Connect()
{
try
{
if(!FCommunicatorPtr)
{
Ice::StringSeq args;
string Tmp=GetICECommunicatorConfig(FHostIP,FHostPort);
args.push_back(Tmp);
args.push_back("Ice.ACM.Client=0");
args.push_back("Ice.MessageSizeMax=30000");
// FCommunicator = Ice::initialize(args);
FCommunicatorPtr = Ice::initialize();
cout<<FServiceName+":通讯器成功初始化!" <<std::endl;
}
Ice::ObjectPrx base=FCommunicatorPtr->stringToProxy(GetICEObjectConfig(FHostIP,FHostPort));
FSendBufferPrx=InfoDTV::Multiplexer::Dynamic::Provider::DynamicBufferTransferPrx::checkedCast(base);
if(!FSendBufferPrx)
{
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
}
catch (const Ice::Exception & e)
{
cout<<string(e.what())<<"dddd"<<std::endl;
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
catch (...)
{
cout<<FServiceName+":Connect:通讯器初始化失败!"<<std::endl;
// Console.Error.WriteLine(ex);
if(FCommunicatorPtr)
{
FCommunicatorPtr->destroy();
FCommunicatorPtr=NULL;
}
return false;
}
return true;
}
开发者ID:vvhh2003,项目名称:InfoDTV,代码行数:54,代码来源:DynamicICESender.cpp
示例6:
Ice::StringSeq
NodeSessionI::getServers(const Ice::Current&) const
{
ServerEntrySeq servers = _database->getNode(_info->name)->getServers();
Ice::StringSeq names;
for(ServerEntrySeq::const_iterator p = servers.begin(); p != servers.end(); ++p)
{
names.push_back((*p)->getId());
}
return names;
}
开发者ID:hadoop835,项目名称:ice,代码行数:11,代码来源:NodeSessionI.cpp
示例7: sync
void
NodeI::checkConsistency(const NodeSessionPrx& session)
{
//
// Only do the consistency check on the startup. This ensures that servers can't
// be removed by a bogus master when the master session is re-established.
//
if(_consistencyCheckDone)
{
return;
}
_consistencyCheckDone = true;
//
// We use a serial number to keep track of the concurrent changes
// on the node. When a server is loaded/destroyed the serial is
// incremented. This allows to ensure that the list of servers
// returned by the registry is consistent with the servers
// currently deployed on the node: if the serial didn't change
// after getting the list of servers from the registry, we have
// the accurate list of servers that should be deployed on the
// node.
//
unsigned long serial = 0;
Ice::StringSeq servers;
vector<ServerCommandPtr> commands;
while(true)
{
{
Lock sync(*this);
if(serial == _serial)
{
_serial = 1; // We can reset the serial number.
commands = checkConsistencyNoSync(servers);
break;
}
serial = _serial;
}
assert(session);
try
{
servers = session->getServers();
}
catch(const Ice::LocalException&)
{
return; // The connection with the session was lost.
}
sort(servers.begin(), servers.end());
}
for_each(commands.begin(), commands.end(), IceUtil::voidMemFun(&ServerCommand::execute));
}
开发者ID:chenbk85,项目名称:ice,代码行数:52,代码来源:NodeI.cpp
示例8: BookExistsException
Demo::BookPrx
LibraryI::createBook(const Demo::BookDescription& description, const Ice::Current& c)
{
IceUtil::Mutex::Lock lock(*this);
BookPrx book = IsbnToBook(c.adapter)(description.isbn);
try
{
book->ice_ping();
//
// The book already exists.
//
throw BookExistsException();
}
catch(const Ice::ObjectNotExistException&)
{
//
// Book doesn't exist, ignore the exception.
//
}
BookPtr bookI = new BookI(this);
bookI->description = description;
//
// Create a new Ice Object in the evictor, using the new identity
// and the new Servant.
//
// This can throw EvictorDeactivatedException (which indicates an
// internal error). The exception is currently ignored.
//
Ice::Identity ident = createBookIdentity(description.isbn);
_evictor->add(bookI, ident);
//
// Add the isbn number to the authors map.
//
Ice::StringSeq isbnSeq;
StringIsbnSeqDict::iterator p = _authors.find(description.authors);
if(p != _authors.end())
{
isbnSeq = p->second;
}
isbnSeq.push_back(description.isbn);
_authors.put(StringIsbnSeqDict::value_type(description.authors, isbnSeq));
return book;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:51,代码来源:LibraryI.cpp
示例9:
bool
IcePHP::createStringArray(zval* zv, const Ice::StringSeq& seq)
{
array_init(zv);
for(Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
if(add_next_index_stringl(zv, STRCAST(p->c_str()), static_cast<uint>(p->length())) == FAILURE)
{
return false;
}
}
return true;
}
开发者ID:ming-hai,项目名称:ice,代码行数:14,代码来源:Util.cpp
示例10: assert
int
main(int argc, char* argv[])
#endif
{
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
assert(args.size() > 0);
const string appName = args[0];
Ice::InitializationData initData;
FreezeScript::CompactIdResolverIPtr resolver = new FreezeScript::CompactIdResolverI;
initData.compactIdResolver = resolver;
Ice::CommunicatorPtr communicator;
int status = EXIT_SUCCESS;
try
{
communicator = Ice::initialize(args, initData);
status = run(args, communicator, resolver);
}
catch(const FreezeScript::FailureException& ex)
{
string reason = ex.reason();
cerr << appName << ": " << reason;
if(reason[reason.size() - 1] != '\n')
{
cerr << endl;
}
return EXIT_FAILURE;
}
catch(const std::exception& ex)
{
cerr << appName << ": " << ex.what() << endl;
status = EXIT_FAILURE;
}
catch(...)
{
cerr << appName << ": unknown error" << endl;
return EXIT_FAILURE;
}
if(communicator)
{
communicator->destroy();
}
return status;
}
开发者ID:BlackHoleJet,项目名称:freeze,代码行数:48,代码来源:DumpDB.cpp
示例11: if
bool
IcePy::listToStringSeq(PyObject* l, Ice::StringSeq& seq)
{
assert(PyList_Check(l));
Py_ssize_t sz = PyList_GET_SIZE(l);
for(Py_ssize_t i = 0; i < sz; ++i)
{
PyObject* item = PyList_GET_ITEM(l, i);
if(!item)
{
return false;
}
string str;
if(checkString(item))
{
str = getString(item);
}
else if(item != Py_None)
{
PyErr_Format(PyExc_ValueError, STRCAST("list element must be a string"));
return false;
}
seq.push_back(str);
}
return true;
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:28,代码来源:Util.cpp
示例12: s
bool
IcePHP::extractStringArray(zval* zv, Ice::StringSeq& seq)
{
if(Z_TYPE_P(zv) != IS_ARRAY)
{
string s = zendTypeToString(Z_TYPE_P(zv));
invalidArgument("expected an array of strings but received %s", s.c_str());
return false;
}
HashTable* arr = Z_ARRVAL_P(zv);
zval* val;
ZEND_HASH_FOREACH_VAL(arr, val)
{
if(Z_TYPE_P(val) != IS_STRING)
{
invalidArgument("array element must be a string");
return false;
}
string s(Z_STRVAL_P(val), Z_STRLEN_P(val));
seq.push_back(s);
}
ZEND_HASH_FOREACH_END();
return true;
}
开发者ID:ming-hai,项目名称:ice,代码行数:27,代码来源:Util.cpp
示例13: InitCommunicator
void ICEBufferReciver::InitCommunicator()
{
try
{
Ice::StringSeq args;
args.push_back(GetICECommunicatorConfig());
// FCommunicator = Ice::initialize(args);
FCommunicator = Ice::initialize();
Log(FServiceName+":通讯器成功初始化!" );
}
catch (const Ice::Exception & e)
{
Log(string(e.what()));
}
catch (...)
{
Log(FServiceName+":通讯器初始化失败!");
// Console.Error.WriteLine(ex);
}
}
开发者ID:vvhh2003,项目名称:InfoDTV,代码行数:22,代码来源:BufferReciver.cpp
示例14: sync
Ice::StringSeq
MetricsAdminI::getMetricsViewNames(Ice::StringSeq& disabledViews, const Current&)
{
Ice::StringSeq enabledViews;
Lock sync(*this);
for(map<string, MetricsViewIPtr>::const_iterator p = _views.begin(); p != _views.end(); ++p)
{
enabledViews.push_back(p->first);
}
#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES)
for(set<string>::const_iterator p = _disabledViews.begin(); p != _disabledViews.end(); ++p)
{
disabledViews.push_back(*p);
}
#else
disabledViews.insert(disabledViews.end(), _disabledViews.begin(), _disabledViews.end());
#endif
return enabledViews;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:23,代码来源:MetricsAdminI.cpp
示例15: assert
bool
IcePy::stringSeqToList(const Ice::StringSeq& seq, PyObject* l)
{
assert(PyList_Check(l));
for(Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
PyObject* str = Py_BuildValue(STRCAST("s"), p->c_str());
if(!str)
{
Py_DECREF(l);
return false;
}
int status = PyList_Append(l, str);
Py_DECREF(str); // Give ownership to the list.
if(status < 0)
{
Py_DECREF(l);
return false;
}
}
return true;
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:24,代码来源:Util.cpp
示例16: lock
void
LibraryI::remove(const BookDescription& description)
{
IceUtil::Mutex::Lock lock(*this);
//
// Note: no need to catch and retry on deadlock since all access to
// _authors is serialized.
//
try
{
StringIsbnSeqDict::iterator p = _authors.find(description.authors);
assert(p != _authors.end());
//
// Remove the isbn number from the sequence.
//
Ice::StringSeq isbnSeq = p->second;
isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)),
isbnSeq.end());
if(isbnSeq.empty())
{
//
// If there are no further associated isbn numbers then remove
// the record.
//
_authors.erase(p);
}
else
{
//
// Otherwise, write back the new record.
//
p.set(isbnSeq);
}
//
// This can throw EvictorDeactivatedException (which indicates
// an internal error). The exception is currently ignored.
//
_evictor->remove(createBookIdentity(description.isbn));
}
catch(const Freeze::DatabaseException& ex)
{
DatabaseException e;
e.message = ex.message;
throw e;
}
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:52,代码来源:LibraryI.cpp
示例17: out
PyObject*
IcePy_loadSlice(PyObject* /*self*/, PyObject* args)
{
char* cmd;
PyObject* list = 0;
if(!PyArg_ParseTuple(args, STRCAST("s|O!"), &cmd, &PyList_Type, &list))
{
return 0;
}
vector<string> argSeq;
try
{
argSeq = IceUtilInternal::Options::split(cmd);
}
catch(const IceUtilInternal::BadOptException& ex)
{
PyErr_Format(PyExc_RuntimeError, "error in Slice options: %s", ex.reason.c_str());
return 0;
}
catch(const IceUtilInternal::APIException& ex)
{
PyErr_Format(PyExc_RuntimeError, "error in Slice options: %s", ex.reason.c_str());
return 0;
}
if(list)
{
if(!listToStringSeq(list, argSeq))
{
return 0;
}
}
IceUtilInternal::Options opts;
opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
opts.addOpt("", "checksum");
opts.addOpt("", "all");
vector<string> files;
try
{
argSeq.insert(argSeq.begin(), ""); // dummy argv[0]
files = opts.parse(argSeq);
if(files.empty())
{
PyErr_Format(PyExc_RuntimeError, "no Slice files specified in `%s'", cmd);
return 0;
}
}
catch(const IceUtilInternal::BadOptException& ex)
{
PyErr_Format(PyExc_RuntimeError, "error in Slice options: %s", ex.reason.c_str());
return 0;
}
catch(const IceUtilInternal::APIException& ex)
{
PyErr_Format(PyExc_RuntimeError, "error in Slice options: %s", ex.reason.c_str());
return 0;
}
vector<string> cppArgs;
Ice::StringSeq includePaths;
bool debug = false;
bool ice = true; // This must be true so that we can create Ice::Identity when necessary.
bool underscore = opts.isSet("underscore");
bool all = false;
bool checksum = false;
if(opts.isSet("D"))
{
vector<string> optargs = opts.argVec("D");
for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
cppArgs.push_back("-D" + *i);
}
}
if(opts.isSet("U"))
{
vector<string> optargs = opts.argVec("U");
for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
cppArgs.push_back("-U" + *i);
}
}
if(opts.isSet("I"))
{
includePaths = opts.argVec("I");
for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
cppArgs.push_back("-I" + *i);
}
}
debug = opts.isSet("d") || opts.isSet("debug");
all = opts.isSet("all");
checksum = opts.isSet("checksum");
//.........这里部分代码省略.........
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:101,代码来源:Slice.cpp
示例18: test
GPrxPtr
allTests(const Ice::CommunicatorPtr& communicator)
{
#ifdef ICE_OS_UWP
bool uwp = true;
#else
bool uwp = false;
#endif
cout << "testing Ice.Admin.Facets property... " << flush;
test(communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets").empty());
communicator->getProperties()->setProperty("Ice.Admin.Facets", "foobar");
Ice::StringSeq facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 1 && facetFilter[0] == "foobar");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "foo\\'bar");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 1 && facetFilter[0] == "foo'bar");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" &&
facetFilter[2] == "titi");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 2 && facetFilter[0] == "foo bar' toto" && facetFilter[1] == "titi");
// communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' 'toto titi");
// facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
// test(facetFilter.size() == 0);
communicator->getProperties()->setProperty("Ice.Admin.Facets", "");
cout << "ok" << endl;
cout << "testing facet registration exceptions... " << flush;
string localOAEndpoint;
{
ostringstream ostr;
if(communicator->getProperties()->getProperty("Ice.Default.Protocol") == "bt")
{
ostr << "default -a *";
}
else
{
ostr << "default -h *";
}
localOAEndpoint = ostr.str();
}
communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", localOAEndpoint);
if(uwp || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" &&
communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss"))
{
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter");
Ice::ObjectPtr obj = ICE_MAKE_SHARED(EmptyI);
adapter->add(obj, Ice::stringToIdentity("d"));
adapter->addFacet(obj, Ice::stringToIdentity("d"), "facetABCD");
try
{
adapter->addFacet(obj, Ice::stringToIdentity("d"), "facetABCD");
test(false);
}
catch(const Ice::AlreadyRegisteredException&)
{
}
adapter->removeFacet(Ice::stringToIdentity("d"), "facetABCD");
try
{
adapter->removeFacet(Ice::stringToIdentity("d"), "facetABCD");
test(false);
}
catch(const Ice::NotRegisteredException&)
{
}
cout << "ok" << endl;
cout << "testing removeAllFacets... " << flush;
Ice::ObjectPtr obj1 = ICE_MAKE_SHARED(EmptyI);
Ice::ObjectPtr obj2 = ICE_MAKE_SHARED(EmptyI);
adapter->addFacet(obj1, Ice::stringToIdentity("id1"), "f1");
adapter->addFacet(obj2, Ice::stringToIdentity("id1"), "f2");
Ice::ObjectPtr obj3 = ICE_MAKE_SHARED(EmptyI);
adapter->addFacet(obj1, Ice::stringToIdentity("id2"), "f1");
adapter->addFacet(obj2, Ice::stringToIdentity("id2"), "f2");
adapter->addFacet(obj3, Ice::stringToIdentity("id2"), "");
Ice::FacetMap fm = adapter->removeAllFacets(Ice::stringToIdentity("id1"));
test(fm.size() == 2);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
try
{
adapter->removeAllFacets(Ice::stringToIdentity("id1"));
test(false);
}
catch(const Ice::NotRegisteredException&)
{
}
fm = adapter->removeAllFacets(Ice::stringToIdentity("id2"));
test(fm.size() == 3);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
test(fm[""] == obj3);
cout << "ok" << endl;
adapter->deactivate();
//.........这里部分代码省略.........
开发者ID:ming-hai,项目名称:ice,代码行数:101,代码来源:AllTests.cpp
示例19: out
vector<ServerCommandPtr>
NodeI::checkConsistencyNoSync(const Ice::StringSeq& servers)
{
vector<ServerCommandPtr> commands;
//
// Check if the servers directory doesn't contain more servers
// than the registry really knows.
//
Ice::StringSeq contents;
try
{
contents = readDirectory(_serversDir);
}
catch(const string& msg)
{
Ice::Error out(_traceLevels->logger);
out << "couldn't read directory `" << _serversDir << "':\n" << msg;
return commands;
}
vector<string> remove;
set_difference(contents.begin(), contents.end(), servers.begin(), servers.end(), back_inserter(remove));
//
// Remove the extra servers if possible.
//
try
{
vector<string>::iterator p = remove.begin();
while(p != remove.end())
{
ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(*p)));
if(server)
{
//
// If the server is loaded, we invoke on it to destroy it.
//
try
{
ServerCommandPtr command = server->destroy(0, "", 0, "Master", false);
if(command)
{
commands.push_back(command);
}
p = remove.erase(p);
continue;
}
catch(const Ice::LocalException& ex)
{
Ice::Error out(_traceLevels->logger);
out << "server `" << *p << "' destroy failed:\n" << ex;
}
catch(const string&)
{
assert(false);
}
}
try
{
if(canRemoveServerDirectory(*p))
{
//
// If the server directory can be removed and we
// either remove it or back it up before to remove it.
//
removeRecursive(_serversDir + "/" + *p);
p = remove.erase(p);
continue;
}
}
catch(const string& msg)
{
Ice::Warning out(_traceLevels->logger);
out << "removing server directory `" << _serversDir << "/" << *p << "' failed:\n" << msg;
}
*p = _serversDir + "/" + *p;
++p;
}
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
//
// Just return the server commands, we'll finish the
// consistency check next time the node is started.
//
return commands;
}
if(!remove.empty())
{
Ice::Warning out(_traceLevels->logger);
out << "server directories containing data not created or written by IceGrid were not removed:\n";
out << toString(remove);
}
return commands;
}
开发者ID:chenbk85,项目名称:ice,代码行数:99,代码来源:NodeI.cpp
示例20: readDirectory
bool
NodeI::canRemoveServerDirectory(const string& name)
{
//
// Check if there's files which we didn't create.
//
Ice::StringSeq c = readDirectory(_serversDir + "/" + name);
set<string> contents(c.begin(), c.end());
contents.erase("dbs");
contents.erase("config");
contents.erase("distrib");
contents.erase("revision");
contents.erase("data");
Ice::StringSeq serviceDataDirs;
for(set<string>::const_iterator p = contents.begin(); p != contents.end(); ++p)
{
if(p->find("data_") != 0)
{
return false;
}
serviceDataDirs.push_back(*p);
}
if(!contents.empty())
{
return false;
}
c = readDirectory(_serversDir + "/" + name + "/config");
for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p)
{
if(p->find("config") != 0)
{
return false;
}
}
if(IceUtilInternal::directoryExists(_serversDir + "/" + name + "/dbs"))
{
c = readDirectory(_serversDir + "/" + name + "/dbs");
for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p)
{
try
{
Ice::StringSeq files = readDirectory(_serversDir + "/" + name + "/dbs/" + *p);
files.erase(remove(files.begin(), files.end(), "DB_CONFIG"), files.end());
files.erase(remove(files.begin(), files.end(), "__Freeze"), files.end());
if(!files.empty())
{
return false;
}
}
catch(const string&)
{
return false;
}
}
}
if(IceUtilInternal::directoryExists(_serversDir + "/" + name + "/data"))
{
if(!readDirectory(_serversDir + "/" + name + "/data").empty())
{
return false;
}
}
for(Ice::StringSeq::const_iterator p = serviceDataDirs.begin(); p != serviceDataDirs.end(); ++p)
{
try
{
if(!readDirectory(_serversDir + "/" + name + "/" + *p).empty())
{
return false;
}
}
catch(const string&)
{
return false;
}
}
return true;
}
开发者ID:chenbk85,项目名称:ice,代码行数:82,代码来源:NodeI.cpp
注:本文中的ice::StringSeq类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论