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));
    }
IPropertyTree *getPkgSetRegistry(const char *process, bool readonly)
{
    Owned<IRemoteConnection> globalLock = querySDS().connect("/PackageSets/", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, SDS_LOCK_TIMEOUT);
    if (!globalLock)
        throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to connect to PackageSet information in dali /PackageSets");
    IPropertyTree *pkgSets = globalLock->queryRoot();
    if (!pkgSets)
        throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to open PackageSet information in dali /PackageSets");

    if (!process || !*process)
        process = "*";
    StringBuffer id;
    buildPkgSetId(id, process);

    //Only lock the branch for the target we're interested in.
    VStringBuffer xpath("/PackageSets/PackageSet[@id='%s']", id.str());
    Owned<IRemoteConnection> conn = querySDS().connect(xpath.str(), myProcessSession(), readonly ? RTM_LOCK_READ : RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
    if (!conn)
    {
        if (readonly)
            return NULL;

        Owned<IPropertyTree> pkgSet = createPTree();
        pkgSet->setProp("@id", id.str());
        pkgSet->setProp("@process", process);
        pkgSets->addPropTree("PackageSet", pkgSet.getClear());
        globalLock->commit();

        conn.setown(querySDS().connect(xpath.str(), myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT));
    }

    return (conn) ? conn->getRoot() : NULL;
}
Ejemplo n.º 3
0
void WebServicesExtractor::getAttributeText(StringBuffer & text, const char* attributeName)
{
    const char * dot = strrchr(attributeName, '.');
    if(!dot || !dot[1])
        throw MakeStringException(3, "Please specify both module and attribute");

    OwnedHqlExpr symbol = getResolveAttributeFullPath(attributeName, LSFpublic, lookupCtx); 
    if (!symbol || !hasNamedSymbol(symbol) || !symbol->hasText()) 
    {
        StringBuffer txt;
        txt.append("Could not read attribute: ").append(attributeName);
        DBGLOG("%s", txt.str());
        throw MakeStringException(ERR_NO_ATTRIBUTE_TEXT, "%s", txt.str());
    }

    symbol->getTextBuf(text);

    /* MORE: It would be preferable if this was better integrated with hqlgram2.cpp.  It's a reasonable stopgap */
    if (archive)
    {
        StringAttr moduleName(attributeName, dot-attributeName);
        IPropertyTree * moduleTree = queryEnsureArchiveModule(archive, moduleName, NULL);
        IPropertyTree * attrTree = queryArchiveAttribute(moduleTree, dot+1);
        if (!attrTree)
        {
            attrTree = createArchiveAttribute(moduleTree, dot+1);

            const char * p = text.str();
            if (0 == strncmp(p, UTF8_BOM,3))
                p += 3;
            attrTree->setProp("", p);
        }
    }
}
Ejemplo n.º 4
0
 ForEachChild(i, record)
 {
     IHqlExpression * cur = record->queryChild(i);
     switch (cur->getOperator())
     {
     case no_record:
         //MORE: If this is a public symbol it should be expanded, otherwise it will be elsewhere.
         expandRecordSymbolsMeta(metaTree, cur);
         break;
     case no_field:
         {
             IPropertyTree * field = metaTree->addPropTree("Field");
             field->setProp("@name", str(cur->queryId()));
             StringBuffer ecltype;
             cur->queryType()->getECLType(ecltype);
             field->setProp("@type", ecltype);
             break;
         }
     case no_ifblock:
         {
             IPropertyTree * block = metaTree->addPropTree("IfBlock");
             expandRecordSymbolsMeta(block, cur->queryChild(1));
             break;
         }
     case no_attr:
     case no_attr_link:
     case no_attr_expr:
         {
             IPropertyTree * attr = metaTree->addPropTree("Attr");
             attr->setProp("@name", str(cur->queryName()));
             break;
         }
     }
 }
Ejemplo n.º 5
0
CWsMachineSoapBindingEx::CWsMachineSoapBindingEx(IPropertyTree* cfg, 
                                                 const char *bindname/*=NULL*/, 
                                                 const char *procname/*=NULL*/)
   :Cws_machineSoapBinding(cfg, bindname, procname)
{
    StringBuffer xpath;
    xpath.appendf("Software/EspProcess[@name=\"%s\"]", procname);
   IPropertyTree* pEspProcess = cfg->queryPropTree(xpath.str());

   if (pEspProcess)
   {
       xpath.clear().appendf("EspBinding[@name=\"%s\"]/@service", bindname);
      const char* service = pEspProcess->queryProp(xpath.str());

      if (service)
      {
          xpath.clear().appendf("EspService[@name=\"%s\"]/MachineInfo/Software/*", service);
         Owned<IPropertyTreeIterator> it = pEspProcess->getElements(xpath.str());
         ForEach(*it)
         {
            m_processTypes.append(it->query().queryName());
         }
         m_processTypes.sort(SortFunction);
      }
   }
}
Ejemplo n.º 6
0
static bool ensureThorIsDown(const char *cluster, bool nofail, bool wait)
{
    bool retry = false;
    do {
        Owned<IRemoteConnection> pStatus = querySDS().connect("/Status/Servers", myProcessSession(), RTM_NONE, SDS_LOCK_TIMEOUT);
        Owned<IPropertyTreeIterator> it = pStatus->queryRoot()->getElements("Server[@name='ThorMaster']");
        retry = false;
        ForEach(*it) {
            IPropertyTree* pServer = &it->query();
            if (pServer->hasProp("@cluster") && !strcmp(pServer->queryProp("@cluster"), cluster)) {
                if (nofail) {
                    WARNLOG("A Thor on cluster %s is still active", cluster);
                    if (!wait)
                        return false;
                    Sleep(1000*10);
                    PROGLOG("Retrying...");
                    retry = true;
                    break;
                }
                throw MakeStringException(-1, "A Thor cluster node swap requires the cluster to be offline.  Please stop the Thor cluster '%s' and try again.", cluster);
            }
        }
    } while (retry);
    return true;
}
Ejemplo n.º 7
0
bool getIsOpt(const IPropertyTree &graphNode)
{
    if (graphNode.hasProp("att[@name='_isOpt']"))
        return graphNode.getPropBool("att[@name='_isOpt']/@value", false);
    else
        return graphNode.getPropBool("att[@name='_isIndexOpt']/@value", false);
}
void CLogContentFilter::readAllLogFilters(IPropertyTree* cfg)
{
    bool groupFilterRead = false;
    VStringBuffer xpath("Filters/Filter[@type='%s']", espLogContentGroupNames[ESPLCGBackEndResp]);
    IPropertyTree* filter = cfg->queryBranch(xpath.str());
    if (filter && filter->hasProp("@value"))
    {
        logBackEndResp = filter->getPropBool("@value");
        groupFilterRead = true;
    }

    xpath.setf("Filters/Filter[@type='%s']", espLogContentGroupNames[ESPLCGBackEndReq]);
    filter = cfg->queryBranch(xpath.str());
    if (filter && filter->hasProp("@value"))
    {
        logBackEndReq = filter->getPropBool("@value");
        groupFilterRead = true;
    }

    for (unsigned i = 0; i < ESPLCGBackEndReq; i++)
    {
        if (readLogFilters(cfg, i))
            groupFilterRead = true;
    }

    if (!groupFilterRead)
    {
        groupFilters.clear();
        readLogFilters(cfg, ESPLCGAll);
    }
}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
0
 void appendSchemaResource(IPropertyTree &res, ILoadedDllEntry *dll)
 {
     if (!dll || (flags & WWV_OMIT_SCHEMAS))
         return;
     if (res.getPropInt("@seq", -1)>=0 && res.hasProp("@id"))
     {
         int id = res.getPropInt("@id");
         size32_t len = 0;
         const void *data = NULL;
         if (dll->getResource(len, data, "RESULT_XSD", (unsigned) id) && len>0)
         {
             buffer.append("<XmlSchema name=\"").append(res.queryProp("@name")).append("\">");
             if (res.getPropBool("@compressed"))
             {
                 StringBuffer decompressed;
                 decompressResource(len, data, decompressed);
                 if (flags & WWV_CDATA_SCHEMAS)
                     buffer.append("<![CDATA[");
                 buffer.append(decompressed.str());
                 if (flags & WWV_CDATA_SCHEMAS)
                     buffer.append("]]>");
             }
             else
                 buffer.append(len, (const char *)data);
             buffer.append("</XmlSchema>");
         }
     }
 }
Ejemplo n.º 11
0
unsigned SWProcess::add(IPropertyTree *params)
{
  unsigned rc = SWComponentBase::add(params);

  IPropertyTree * envTree = m_envHelper->getEnvTree();
  const char* key = params->queryProp("@key");
  StringBuffer xpath;
  xpath.clear().appendf(XML_TAG_SOFTWARE "/%s[@name=\"%s\"]", m_processName.str(), key);
  IPropertyTree * compTree = envTree->queryPropTree(xpath.str());
  assert(compTree);
  const char* selector = params->queryProp("@selector");
  if (selector)
  {
     String str(selector);
     if (str.startsWith("instance"))
     {
        addInstances(compTree, params);
     }
     else
     {
       // Following method can be overwritten.
       // For example, NodeGroup in BackupNodeProcess, EspBinding in EspProcess
       addOtherSelector(compTree, params);
     }
  }
  else
  {
     IPropertyTree* pAttrs = params->queryPropTree("Attributes");
     updateNode(compTree, pAttrs);
  }

  return rc;
}
Ejemplo n.º 12
0
IHqlExpression * XmlEclRepository::doLoadSymbol(IPropertyTree * repository, IAtom * modname, IAtom * attrname)
{
    StringBuffer s;
    IPropertyTree* module = repository->queryPropTree(s.append("./Module[@name=\"").append(*modname).append("\"]").str());
    if(!module)
    {
        if (logging())
            DBGLOG("No data for module %s",modname->getAtomNamePtr());
        return 0;
    }
    int access = module->getPropInt("@access",cs_full);

    s.clear().append("./Attribute[@name=\"").append(*attrname).append("\"]");
    Owned<IPropertyTreeIterator> it = module->getElements(s.str());
    for(it->first();it->isValid();it->next())
    {
        Owned<IHqlExpression> item = toNamedSymbol(&it->query(), *modname,access);
        CHqlNamedSymbol* cur = QUERYINTERFACE(item.get(), CHqlNamedSymbol);

        if(cur)
            return LINK(cur);
    }

    return 0;
}
Ejemplo n.º 13
0
void LogicalGraphCreator::beginSubGraph(const char * label, bool nested)
{
    savedGraphId.append(subGraphId);
    if (!nested)
        saveSubGraphs();

    if ((subGraphs.ordinality() == 0) && rootSubGraph)
    {
        subGraphs.append(*LINK(rootSubGraph));
        subGraphId = rootGraphId;
        return;
    }

    subGraphId = ++seq;
    IPropertyTree * node = createPTree("node");
    node = curSubGraph()->addPropTree("node", node);
    node->setPropInt64("@id", subGraphId);

    IPropertyTree * graphAttr = node->addPropTree("att", createPTree("att"));
    IPropertyTree * subGraph = graphAttr->addPropTree("graph", createPTree("graph"));
    subGraphs.append(*LINK(subGraph));
    if (!rootSubGraph)
    {
        rootSubGraph.set(subGraph);
        rootGraphId = subGraphId;
    }
}
Ejemplo n.º 14
0
void SWProcess::addInstances(IPropertyTree *parent, IPropertyTree *params)
{
  IPropertyTree* pAttrs = params->queryPropTree("Attributes");
  if (!pAttrs)
     throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss instance attributes input");

  const char * instanceXMLTagName = getInstanceXMLTagName(params->queryProp("@selector"));

  Owned<IPropertyTreeIterator> iter = pAttrs->getElements("Attribute");

  ForEach (*iter)
  {
     IPropertyTree *attr = &iter->query();
     const char* propName = attr->queryProp("@name");
     if (!stricmp(propName, "ip") || !stricmp(propName, "ipfile"))
     {
        bool isFile = false;
        if (!stricmp(propName, "ipfile")) isFile = true;

        StringArray ips;
        m_envHelper->processNodeAddress(attr->queryProp("@value"), ips, isFile);
        for ( unsigned i = 0; i < ips.ordinality() ; i++)
        {
           IPropertyTree * computerNode = addComputer(ips.item(i));
           addInstance(computerNode, parent, pAttrs, instanceXMLTagName);
        }
     }
  }
}
Ejemplo n.º 15
0
void SWBackupNode::addOtherSelector(IPropertyTree *compTree, IPropertyTree *params)
{
   StringBuffer xpath;

   assert(compTree);
   const char* selector = params->queryProp("@selector");
   if (selector && !stricmp("NodeGroup", selector))
   {
       IPropertyTree *nodeGroup = createPTree(selector);
       IPropertyTree* pAttrs = params->queryPropTree("Attributes");
       updateNode(nodeGroup, pAttrs, NULL);
       if (!nodeGroup->hasProp("@interval"))
       {
          xpath.clear().appendf("xs:element/xs:complexType/xs:sequence/xs:element[@name=\"NodeGroup\"]/xs:complexType/xs:attribute[@name=\"interval\"]/@default");
          const char *interval = m_pSchema->queryProp(xpath.str());
          if ( interval && *interval )
          {
              nodeGroup->addProp("@interval", interval);
          }
          else
          {
              throw MakeStringException(CfgEnvErrorCode::MissingRequiredParam,
                  "Missing required paramter \"interval\" and there is no default value.");
          }
       }
       compTree->addPropTree(selector, nodeGroup);
   }
}
Ejemplo n.º 16
0
WsWuInfo::WsWuInfo(const char *wuid_, const char *qset, const char *qname, const char *user, const char *pw) :
    wuid(wuid_), qsetname(qset), queryname(qname), username(user), password(pw)
{
    Owned<IWorkUnitFactory> wf = getWorkUnitFactory();
    if (!wuid.length() && qsetname.length() && queryname.length())
    {
        Owned<IPropertyTree> qstree = getQueryRegistry(qsetname.sget(), true);
        if (qstree)
        {
            VStringBuffer xpath("Query[@id=\"%s\"]", queryname.sget());
            IPropertyTree *query = qstree->queryPropTree(xpath.str());
            if (query)
                wuid.set(query->queryProp("@wuid"));
            else
                throw MakeStringException(-1, "Query %s not found in QuerySet %s", queryname.sget(), qsetname.sget());
        }
        else
            throw MakeStringException(-1, "QuerySet %s not found", qsetname.sget());
    }
        
    if (wuid.length())
    {
        wu.setown(wf->openWorkUnit(wuid.sget(), false));
        if (!wu)
            throw MakeStringException(-1, "Could not open workunit: %s", wuid.sget());
    }
    else
        throw MakeStringException(-1, "Workunit not specified");
}
Ejemplo n.º 17
0
bool CESPServerLoggingAgent::init(const char * name, const char * type, IPropertyTree * cfg, const char * process)
{
    if (!cfg)
        return false;

    IPropertyTree* espServer = cfg->queryBranch(PropESPServer);
    if(!espServer)
        throw MakeStringException(-1,"Unable to find ESPServer settings for log agent %s:%s", name, type);

    const char* url = espServer->queryProp(PropServerUrl);
    if (url && *url)
        serverUrl.set(url);

    const char* userID = espServer->queryProp(PropServerUserID);
    const char* password = espServer->queryProp(PropServerPassword);
    if (userID && *userID && password && *password)
    {
        serverUserID.set(userID);
        decrypt(serverPassword, password);
    }
    maxServerWaitingSeconds = cfg->getPropInt(PropServerWaitingSeconds);
    maxGTSRetries = cfg->getPropInt(MaxTriesGTS, DefaultMaxTriesGTS);

    readAllLogFilters(cfg);
    return true;
}
//---------------------------------------------------------------------------
// createInstallFileMap
//---------------------------------------------------------------------------
int CEspDeploymentEngine::determineInstallFiles(IPropertyTree& node, CInstallFiles& installFiles) const
{
    m_pCallback->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "Merging file lists for ESP server and its bound service(s) ...");

   const char* myBuild = m_process.queryProp("@build");
   //process bindings for this esp process and add files for each service used by 
   //each binding before adding files for this esp process
   Owned<IPropertyTreeIterator> iBinding = m_process.getElements("EspBinding");
   ForEach(*iBinding)
   {
      IPropertyTree* pBinding = &iBinding->query();

      const char* szService = pBinding->queryProp("@service");

      // Lookup plugin process
      IPropertyTree* pService = lookupProcess("EspService", szService);
      if (!pService)
         throw MakeStringException(0, "Process %s references unknown esp service '%s'", m_name.get(), szService);

      const char* pszBuild = pService->queryProp("@build");
      if (!pszBuild || 0 != strcmp(pszBuild, myBuild))
         throw MakeStringException(0, "ESP service '%s' used by ESP process '%s'\n has a different build (%s) to its ESP process!", 
                                   szService, m_name.get(), pszBuild);

         // Get plugin file list from the plugin process
      CDeploymentEngine::determineInstallFiles(*pService, installFiles);
   }
    int rc = CDeploymentEngine::determineInstallFiles(node, installFiles);
    m_pCallback->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "determineInstallFiles complete");
   return rc;
}
Ejemplo n.º 19
0
void SWProcess::modify(IPropertyTree *params)
{
  SWComponentBase::modify(params);

  const char * selector = params->queryProp("@selector");
  if ( selector )
  {
     IPropertyTree * envTree = m_envHelper->getEnvTree();
     const char* key = params->queryProp("@key");
     StringBuffer xpath;
     xpath.clear().appendf(XML_TAG_SOFTWARE "/%s[@name=\"%s\"]", m_processName.str(), key);
     IPropertyTree * compTree = envTree->queryPropTree(xpath.str());
     if (!compTree)
        throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Selector should matche one element in modify.");

     String str(selector);
     if (str.startsWith("instance"))
        modifyInstance(compTree, params);

     return;
  }

  if (!(params->queryPropTree("Attributes/Attribute[@name=\"name\"]"))) return;

  //notify topoploy for  component name change
  const char *oldName = params->queryProp("@key");
  const char *newName = params->queryProp("Attributes/Attribute[@name=\"name\"]/@value");
  if (m_notifyTopologyList.find(m_name.str()) != NotFound)
  {
     ((SWProcess*)m_envHelper->getEnvSWComp("topology"))->processNameChanged(m_name.str(), newName, oldName);
  }

}
void CWSESPControlEx::setSessionTimeout(int timeoutMinutes, IPropertyTree& session)
{
    CDateTime timeNow;
    timeNow.setNow();
    time_t simple = timeNow.getSimple() + timeoutMinutes*60;
    session.setPropInt64(PropSessionTimeoutAt, simple);
    session.setPropBool(PropSessionTimeoutByAdmin, true);
}
Ejemplo n.º 21
0
IPropertyTree *CEspBinding::addNavException(IPropertyTree &folder, const char *message/*=NULL*/, int code/*=0*/, const char *source/*=NULL*/)
{
    IPropertyTree *ret = folder.addPropTree("Exception", createPTree());
    ret->addProp("@message", message ? message : "Unknown exception");
    ret->setPropInt("@code", code);
    ret->setProp("@source", source);
    return ret;
}
Ejemplo n.º 22
0
void CEspConfig::initPtree(const char *location, bool isDali)
{
    IPropertyTree* cfg = createPTreeFromXMLFile(location, ipt_caseInsensitive);
    if (cfg)
    {
        cfg->addProp("@config", location);
        m_envpt.setown(cfg);
    }
}
Ejemplo n.º 23
0
 CDaliServixFilter(IPropertyTree &filter)
 {
     const char *subnet = filter.queryProp("@subnet");
     const char *mask = filter.queryProp("@mask");
     if (!ipSubNet.set(subnet, mask))
         throw MakeStringException(0, "Invalid sub net definition: %s, %s", subnet, mask);
     dir.set(filter.queryProp("@directory"));
     trace = filter.getPropBool("@trace");
 }
 void init()
 {
     VStringBuffer xpath("PackageMap[@id='%s']", pmid.str());
     globalLock.setown(querySDS().connect("/PackageMaps", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, SDS_LOCK_TIMEOUT));
     packageMaps = globalLock->queryRoot();
     pmExisting = packageMaps->queryPropTree(xpath);
     if (pmExisting && !pmExisting->getPropBool("@multipart", false))
         convertExisting();
 }
Ejemplo n.º 25
0
void updateManifestResourcePaths(IPropertyTree &resource, const char *dir)
{
    StringBuffer filepath;
    makeAbsolutePath(resource.queryProp("@filename"), dir, filepath);
    resource.setProp("@originalFilename", filepath.str());

    StringBuffer respath;
    makePathUniversal(filepath.str(), respath);
    resource.setProp("@resourcePath", respath.str());
}
Ejemplo n.º 26
0
IPropertyTree * SWProcess::getPortDefinition()
{
   StringBuffer xpath;
   xpath.clear().appendf("xs:element[@name=\"%s\"]", m_instanceElemName.str());
   IPropertyTree * instanceNode =  m_pSchema->queryPropTree(xpath.str());
   if (!instanceNode) return NULL;

   xpath.clear().append("xs:attribute[@name=\"port\"]");
   return  instanceNode->queryPropTree(xpath.str());
}
Ejemplo n.º 27
0
int SWProcess::getDefaultPort()
{
   IPropertyTree * portAttrNode =  getPortDefinition();
   if (!portAttrNode) return 0;
   int defaultValue = portAttrNode->getPropInt("@default");

   if (!defaultValue) return 0;

   return defaultValue;
}
Ejemplo n.º 28
0
IPropertyTree * addIntraGraphEdge(IPropertyTree * subGraph, unsigned __int64 source, unsigned __int64 target, unsigned outputIndex)
{
    IPropertyTree *edge = createPTree();
    edge->setPropInt64("@target", target);
    edge->setPropInt64("@source", source);

    StringBuffer s;
    edge->setProp("@id", s.append(source).append('_').append(outputIndex).str());
    return subGraph->addPropTree("edge", edge);
}
Ejemplo n.º 29
0
IPropertyTree *CEspBinding::ensureNavLink(IPropertyTree &folder, const char *name, const char *path, const char *tooltip, const char *menuname, const char *navPath, unsigned relPosition, bool force)
{
    StringBuffer xpath;
    xpath.appendf("Link[@name=\"%s\"]", name);

    bool addNew = true;
    IPropertyTree *ret = folder.queryPropTree(xpath.str());
    if (ret)
    {
        bool forced = ret->getPropBool("@force");
        if (forced || !force)
            return ret;

        addNew = false;
    }

    if (addNew)
        ret=createPTree("Link");

    ret->setProp("@name", name);
    ret->setProp("@tooltip", tooltip);
    ret->setProp("@path", path);
    ret->setProp("@menu", menuname);
    ret->setProp("@navPath", navPath);
    ret->setPropInt("@relPosition", relPosition);
    ret->setPropBool("@force", force);

    if (addNew)
        folder.addPropTree("Link", ret);

    return ret;
}
Ejemplo n.º 30
0
    virtual void getNavigationData(IEspContext &context, IPropertyTree & data)
    {
        data.setProp("@appName", "EclWatch");
        data.setProp("@start_page", "/WsSMC/Activity");
        IPropertyTree *folder = ensureNavFolder(data, "Clusters", NULL, NULL, false, 1);
        ensureNavLink(*folder, "Activity", "/WsSMC/Activity", "Display Activity on all target clusters in an environment", NULL, NULL, 1);
        ensureNavLink(*folder, "Scheduler", "/WsWorkunits/WUShowScheduled", "Access the ECL Scheduler to view and manage scheduled workunits or events", NULL, NULL, 2);

        IPropertyTree *folderTools = ensureNavFolder(data, "Resources", NULL, NULL, false, 8);
        ensureNavLink(*folderTools, "Browse", "/WsSMC/BrowseResources", "Browse a list of resources available for download, such as the ECL IDE, documentation, examples, etc. These are only available if optional packages are installed on the ESP Server.", NULL, NULL, 1);
    }