本文整理汇总了C++中IPropertyTree::removeTree方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::removeTree方法的具体用法?C++ IPropertyTree::removeTree怎么用?C++ IPropertyTree::removeTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::removeTree方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deletePkgInfo
bool deletePkgInfo(const char *name, const char *target, const char *process, bool globalScope)
{
Owned<IRemoteConnection> pkgSetsConn = querySDS().connect("/PackageSets/", myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
if (!pkgSetsConn)
throw MakeStringException(PKG_NONE_DEFINED, "No package sets defined");
IPropertyTree* packageSets = pkgSetsConn->queryRoot();
StringBuffer pkgSetId;
buildPkgSetId(pkgSetId, process);
VStringBuffer pkgSet_xpath("PackageSet[@id='%s']", pkgSetId.str());
IPropertyTree *pkgSetRegistry = packageSets->queryPropTree(pkgSet_xpath.str());
if (!pkgSetRegistry)
throw MakeStringException(PKG_TARGET_NOT_DEFINED, "No package sets defined for %s", process);
StringBuffer lcTarget(target);
target = lcTarget.toLowerCase().str();
StringBuffer lcName(name);
name = lcName.toLowerCase().str();
Owned<IPropertyTree> mapEntry;
StringBuffer xpath;
if (!globalScope)
{
xpath.appendf("PackageMap[@id='%s::%s'][@querySet='%s']", target, name, target);
mapEntry.setown(pkgSetRegistry->getPropTree(xpath.str()));
}
if (!mapEntry)
{
xpath.clear().appendf("PackageMap[@id='%s'][@querySet='%s']", name, target);
mapEntry.setown(pkgSetRegistry->getPropTree(xpath.str()));
if (!mapEntry)
throw MakeStringException(PKG_DELETE_NOT_FOUND, "Unable to delete %s - information not found", lcName.str());
}
StringAttr pmid(mapEntry->queryProp("@id"));
pkgSetRegistry->removeTree(mapEntry);
xpath.clear().appendf("PackageSet/PackageMap[@id='%s']", pmid.get());
if (!packageSets->hasProp(xpath))
{
Owned<IRemoteConnection> pkgMapsConn = querySDS().connect("/PackageMaps/", myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
if (!pkgMapsConn)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve PackageMaps information from dali [/PackageMaps]");
IPropertyTree *pkgMaps = pkgMapsConn->queryRoot();
if (!pkgMaps)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve PackageMaps information from dali [/PackageMaps]");
IPropertyTree *mapTree = pkgMaps->queryPropTree(xpath.clear().appendf("PackageMap[@id='%s']", pmid.get()).str());
if (mapTree)
pkgMaps->removeTree(mapTree);
}
return true;
}
示例2: doCreate
void doCreate(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
{
createPart(partname, xml);
if (pmExisting)
{
if (!checkFlag(PKGADD_MAP_REPLACE))
throw MakeStringException(PKG_NAME_EXISTS, "PackageMap %s already exists, either delete it or specify overwrite", pmid.str());
}
cloneDfsInfo(updateFlags, filesNotFound);
if (pmExisting)
packageMaps->removeTree(pmExisting);
Owned<IPropertyTree> pmTree = createPTree("PackageMap", ipt_ordered);
pmTree->setProp("@id", pmid);
pmTree->setPropBool("@multipart", true);
pmTree->addPropTree("Part", pmPart.getClear());
packageMaps->addPropTree("PackageMap", pmTree.getClear());
VStringBuffer xpath("PackageMap[@id='%s'][@querySet='%s']", pmid.str(), target.get());
Owned<IPropertyTree> pkgSet = getPkgSetRegistry(process, false);
IPropertyTree *psEntry = pkgSet->queryPropTree(xpath);
if (!psEntry)
{
psEntry = pkgSet->addPropTree("PackageMap", createPTree("PackageMap"));
psEntry->setProp("@id", pmid);
psEntry->setProp("@querySet", target);
}
makePackageActive(pkgSet, psEntry, target, checkFlag(PKGADD_MAP_ACTIVATE));
}
示例3: convertExisting
void convertExisting()
{
Linked<IPropertyTree> pmPart = pmExisting;
const char *s = strstr(pmid.str(), "::");
if (s)
pmPart->addProp("@id", s+2);
packageMaps->removeTree(pmExisting);
Owned<IPropertyTree> pmTree = createPTree("PackageMap", ipt_ordered);
pmTree->setProp("@id", pmid);
pmTree->setPropBool("@multipart", true);
pmTree->addPropTree("Part", pmPart.getClear());
pmExisting = packageMaps->addPropTree("PackageMap", pmTree.getClear());
}
示例4: computerDeleted
void SWProcess::computerDeleted(const char* ipAddress, const char* computerName, const char *instanceXMLTagName)
{
IPropertyTree * software = m_envHelper->getEnvTree()->queryPropTree(XML_TAG_SOFTWARE);
Owned<IPropertyTreeIterator> compIter = software->getElements(m_processName);
const char *instance = (instanceXMLTagName)? instanceXMLTagName: m_instanceElemName.str();
synchronized block(mutex);
ForEach (*compIter)
{
IPropertyTree * comp = &compIter->query();
Owned<IPropertyTreeIterator> instanceIter = comp->getElements(instance);
ForEach (*instanceIter)
{
IPropertyTree * instance = &instanceIter->query();
if ((instance->hasProp(m_ipAttribute.str()) && stricmp(instance->queryProp(m_ipAttribute.str()), ipAddress)) ||
(instance->hasProp("@computer") && stricmp(instance->queryProp("@computer"), computerName)))
comp->removeTree(instance);
}
}
}
示例5: addPart
void addPart(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
{
init();
if (!pmExisting)
{
doCreate(partname, xml, updateFlags, filesNotFound);
return;
}
createPart(partname, xml);
VStringBuffer xpath("Part[@id='%s']", partname);
IPropertyTree *existingPart = pmExisting->queryPropTree(xpath);
if (existingPart && !checkFlag(PKGADD_SEG_REPLACE))
throw MakeStringException(PKG_NAME_EXISTS, "Package Part %s already exists, remove, or specify 'delete previous'", partname);
cloneDfsInfo(updateFlags, filesNotFound);
if (existingPart)
pmExisting->removeTree(existingPart);
pmExisting->addPropTree("Part", pmPart.getClear());
}
示例6: addPackageMapInfo
void addPackageMapInfo(const char *xml, StringArray &filesNotFound, const char *process, const char *target, const char *pmid, const char *packageSetName, const char *lookupDaliIp, const char *srcCluster, const char *prefix, bool activate, bool overWrite, IUserDescriptor* userdesc, bool allowForeignFiles, bool preloadAll)
{
if (!xml || !*xml)
throw MakeStringExceptionDirect(PKG_INFO_NOT_DEFINED, "PackageMap info not provided");
if (srcCluster && *srcCluster)
{
if (!isProcessCluster(lookupDaliIp, srcCluster))
throw MakeStringException(PKG_INVALID_CLUSTER_TYPE, "Process cluster %s not found on %s DALI", srcCluster, lookupDaliIp ? lookupDaliIp : "local");
}
Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(target);
if (!clusterInfo)
throw MakeStringException(PKG_TARGET_NOT_DEFINED, "Could not find information about target cluster %s ", target);
Owned<IPropertyTree> pmTree = createPTreeFromXMLString(xml);
if (!pmTree)
throw MakeStringExceptionDirect(PKG_INFO_NOT_DEFINED, "Invalid PackageMap info");
StringBuffer lcPmid(pmid);
pmid = lcPmid.toLowerCase().str();
pmTree->setProp("@id", pmid);
Owned<IPropertyTreeIterator> iter = pmTree->getElements("Package");
ForEach(*iter)
{
IPropertyTree &item = iter->query();
if (preloadAll)
item.setPropBool("@preload", true);
Owned<IPropertyTreeIterator> superFiles = item.getElements("SuperFile");
ForEach(*superFiles)
{
IPropertyTree &superFile = superFiles->query();
StringBuffer lc(superFile.queryProp("@id"));
const char *id = lc.toLowerCase().str();
if (*id == '~')
id++;
superFile.setProp("@id", id);
Owned<IPropertyTreeIterator> subFiles = superFile.getElements("SubFile");
ForEach(*subFiles)
{
IPropertyTree &subFile = subFiles->query();
id = subFile.queryProp("@value");
if (id && *id == '~')
{
StringAttr value(id+1);
subFile.setProp("@value", value.get());
}
}
}
}
VStringBuffer xpath("PackageMap[@id='%s']", pmid);
Owned<IRemoteConnection> globalLock = querySDS().connect("/PackageMaps", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, SDS_LOCK_TIMEOUT);
IPropertyTree *packageMaps = globalLock->queryRoot();
IPropertyTree *pmExisting = packageMaps->queryPropTree(xpath);
xpath.appendf("[@querySet='%s']", target);
Owned<IPropertyTree> pkgSet = getPkgSetRegistry(process, false);
IPropertyTree *psEntry = pkgSet->queryPropTree(xpath);
if (!overWrite && (psEntry || pmExisting))
throw MakeStringException(PKG_NAME_EXISTS, "Package name %s already exists, either delete it or specify overwrite", pmid);
cloneFileInfoToDali(filesNotFound, pmTree, lookupDaliIp, clusterInfo, srcCluster, prefix, overWrite, userdesc, allowForeignFiles);
if (pmExisting)
packageMaps->removeTree(pmExisting);
packageMaps->addPropTree("PackageMap", pmTree.getClear());
if (!psEntry)
{
psEntry = pkgSet->addPropTree("PackageMap", createPTree("PackageMap"));
psEntry->setProp("@id", pmid);
psEntry->setProp("@querySet", target);
}
makePackageActive(pkgSet, psEntry, target, activate);
}
示例7: removePart
void removePart(const char *partname)
{
init();
pmExisting->removeTree(ensurePart(partname));
}