本文整理汇总了C++中Owned::addPropTree方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::addPropTree方法的具体用法?C++ Owned::addPropTree怎么用?C++ Owned::addPropTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::addPropTree方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: expandDirectory
void ResourceManifest::expandDirectory(IPropertyTree &res, IDirectoryIterator *it, const char*mask, bool recursive)
{
if (!it)
return;
ForEach(*it)
{
if (it->isDir())
{
if (recursive)
expandDirectory(res, it->query().directoryFiles(mask, false, true), mask, recursive);
continue;
}
StringBuffer reldir;
Owned<IPropertyTree> newRes = createPTreeFromIPT(&res);
reldir.append(splitRelativePath(it->query().queryFilename(), dir, reldir));
VStringBuffer xpath("Resource[@filename='%s']", reldir.str());
if (manifest->hasProp(xpath))
continue;
newRes->setProp("@filename", reldir.str());
updateResourcePaths(*newRes, dir.str());
if (manifest->hasProp(xpath.setf("resource[@resourcePath='%s']", newRes->queryProp("@resourcePath"))))
continue;
manifest->addPropTree("Resource", newRes.getClear());
}
}
示例3: loadInclude
bool ResourceManifest::loadInclude(IPropertyTree &include, const char *dir)
{
const char *filename = include.queryProp("@filename");
StringBuffer includePath;
makeAbsolutePath(filename, dir, includePath);
VStringBuffer xpath("Include[@originalFilename='%s']", includePath.str());
if (manifest->hasProp(xpath.str()))
return false;
include.setProp("@originalFilename", includePath.str());
StringBuffer includeDir;
splitDirTail(includePath, includeDir);
Owned<IPropertyTree> manifestInclude = createPTreeFromXMLFile(includePath.str());
Owned<IPropertyTreeIterator> it = manifestInclude->getElements("*");
ForEach(*it)
{
IPropertyTree &item = it->query();
if (streq(item.queryName(), "Resource"))
updateResourcePaths(item, includeDir.str());
else if (streq(item.queryName(), "Include"))
{
if (!loadInclude(item, includeDir.str()))
continue;
}
manifest->addPropTree(item.queryName(), LINK(&item));
}
return true;
}
示例4: 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());
}
示例5: resolveAttribute
IPropertyTree * WebServicesExtractor::ensureCacheEntry(const char * name)
{
IPropertyTree * match = resolveAttribute(name);
if (match)
return match;
Owned<IPropertyTree> tree = createPTree("attr");
tree->setProp("@name", name);
StringBuffer lowerName;
tree->setProp("@key", lowerName.append(name).toLowerCase());
StringBuffer text;
getAttributeText(text, name);
parseAttribute(tree, text, name);
return root->addPropTree("attr", tree.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: createPTreeForXslt
IPropertyTree* CFileSpraySoapBindingEx::createPTreeForXslt(const char* method, const char* dfuwuid)
{
Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
Owned<IConstEnvironment> m_constEnv = factory->openEnvironment();
Owned<IPropertyTree> pEnvRoot = &m_constEnv->getPTree();
IPropertyTree* pEnvSoftware = pEnvRoot->queryPropTree("Software");
Owned<IPropertyTree> pRoot = createPTreeFromXMLString("<Environment/>");
IPropertyTree* pSoftware = pRoot->addPropTree("Software", createPTree("Software"));
if (pEnvSoftware)
{
StringBuffer dfuwuidSourcePartIP, wuxml;
if(dfuwuid && *dfuwuid)
{
Owned<IDFUWorkUnitFactory> dfuwu_factory = getDFUWorkUnitFactory();
Owned<IConstDFUWorkUnit> dfuwu = dfuwu_factory->openWorkUnit(dfuwuid, false);
if(dfuwu)
{
dfuwu->toXML(wuxml);
Owned<IPropertyTree> wu = createPTreeFromXMLString(wuxml.str());
if (wu)
{
const char* ip = wu->queryProp("Source/Part/@node");
if (ip && *ip)
dfuwuidSourcePartIP.append(ip);
}
}
}
Owned<IPropertyTreeIterator> it = pEnvSoftware->getElements("DropZone");
ForEach(*it)
{
IPropertyTree* pDropZone = pSoftware->addPropTree("DropZone", &it->get());
//get IP Address of the computer associated with this drop zone
const char* pszComputer = it->query().queryProp("@computer");
if (!strcmp(pszComputer, "."))
pszComputer = "localhost";
StringBuffer xpath;
xpath.appendf("Hardware/Computer[@name='%s']/@netAddress", pszComputer);
StringBuffer sNetAddr;
const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
if (strcmp(pszNetAddr, "."))
{
sNetAddr.append(pszNetAddr);
}
else
{
StringBuffer ipStr;
IpAddress ipaddr = queryHostIP();
ipaddr.getIpText(ipStr);
if (ipStr.length() > 0)
{
#ifdef MACHINE_IP
sNetAddr.append(MACHINE_IP);
#else
sNetAddr.append(ipStr.str());
#endif
}
}
pDropZone->addProp("@netAddress", sNetAddr.str());
if ((dfuwuidSourcePartIP.length() > 0) && (sNetAddr.length() > 0))
{
IpAddress ip1(dfuwuidSourcePartIP.str()), ip2(sNetAddr.str());
if (ip1.ipequals(ip2))
pDropZone->addProp("@sourceNode", "1");
}
Owned<IConstMachineInfo> machine;
if (strcmp(pszNetAddr, "."))
machine.setown(m_constEnv->getMachineByAddress(sNetAddr.str()));
else
{
machine.setown(m_constEnv->getMachineByAddress(pszNetAddr));
if (!machine)
machine.setown(m_constEnv->getMachineByAddress(sNetAddr.str()));
}
if (machine)
{
//int os = machine->getOS();
StringBuffer dir;
pDropZone->getProp("@directory", dir);
if (machine->getOS() == MachineOsLinux || machine->getOS() == MachineOsSolaris)
{
dir.replace('\\', '/');//replace all '\\' by '/'
pDropZone->setProp("@linux", "true");
}
else
{
dir.replace('/', '\\');
dir.replace('$', ':');
}
pDropZone->setProp("@directory", dir);
}
}
//.........这里部分代码省略.........
示例8: createPTreeForXslt
IPropertyTree* CFileSpraySoapBindingEx::createPTreeForXslt(double clientVersion, const char* method, const char* dfuwuid)
{
Owned<IEnvironmentFactory> factory = getEnvironmentFactory(true);
Owned<IConstEnvironment> constEnv = factory->openEnvironment();
Owned<IPropertyTree> pEnvRoot = &constEnv->getPTree();
IPropertyTree* pEnvSoftware = pEnvRoot->queryPropTree("Software");
Owned<IPropertyTree> pRoot = createPTreeFromXMLString("<Environment/>");
IPropertyTree* pSoftware = pRoot->addPropTree("Software", createPTree("Software"));
if (pEnvSoftware)
{
StringBuffer dfuwuidSourcePartIP, wuxml;
if(dfuwuid && *dfuwuid)
{
Owned<IDFUWorkUnitFactory> dfuwu_factory = getDFUWorkUnitFactory();
Owned<IConstDFUWorkUnit> dfuwu = dfuwu_factory->openWorkUnit(dfuwuid, false);
if(dfuwu)
{
dfuwu->toXML(wuxml);
Owned<IPropertyTree> wu = createPTreeFromXMLString(wuxml.str());
if (wu)
{
const char* ip = wu->queryProp("Source/Part/@node");
if (ip && *ip)
dfuwuidSourcePartIP.append(ip);
}
}
}
appendDropZones(clientVersion, constEnv, dfuwuidSourcePartIP.str(), pSoftware);
//For Spray files on Thor Cluster, fetch all the group names for all the thor instances (and dedup them)
BoolHash uniqueThorClusterGroupNames;
Owned<IPropertyTreeIterator> it =pEnvSoftware->getElements("ThorCluster");
ForEach(*it)
{
StringBuffer thorClusterGroupName;
IPropertyTree& cluster = it->query();
getClusterGroupName(cluster, thorClusterGroupName);
if (!thorClusterGroupName.length())
continue;
bool* found = uniqueThorClusterGroupNames.getValue(thorClusterGroupName.str());
if (found && *found)
continue;
uniqueThorClusterGroupNames.setValue(thorClusterGroupName.str(), true);
IPropertyTree* newClusterTree = pSoftware->addPropTree("ThorCluster", &it->get());
newClusterTree->setProp("@name", thorClusterGroupName.str()); //set group name into @name for spray target
}
it.setown(pEnvSoftware->getElements("EclAgentProcess"));
ForEach(*it)
{
IPropertyTree &cluster = it->query();
const char* name = cluster.queryProp("@name");
if (!name||!*name)
continue;
unsigned ins = 0;
Owned<IPropertyTreeIterator> insts = cluster.getElements("Instance");
ForEach(*insts)
{
const char *na = insts->query().queryProp("@netAddress");
if (!na || !*na)
{
insts->query().setProp("@gname", name);
continue;
}
SocketEndpoint ep(na);
if (ep.isNull())
continue;
ins++;
StringBuffer gname("hthor__");
//StringBuffer gname;
gname.append(name);
if (ins>1)
gname.append('_').append(ins);
insts->query().setProp("@gname", gname.str());
}
pSoftware->addPropTree("EclAgentProcess", &it->get());
}
if (stricmp(method, "CopyInput") == 0) //Limit for this method only
{
it.setown(pEnvSoftware->getElements("RoxieCluster"));
ForEach(*it)
pSoftware->addPropTree("RoxieCluster", &it->get());
}
if (wuxml.length() > 0)
pSoftware->addPropTree("DfuWorkunit", createPTreeFromXMLString(wuxml.str()));
}
return pRoot.getClear();
//.........这里部分代码省略.........