예제 #1
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);
        }
     }
  }
}
예제 #2
0
void SWDirectories::modify(IPropertyTree *params)
{
  synchronized block(mutex);

  IPropertyTree * envTree = m_envHelper->getEnvTree();

  IPropertyTree * pAttrsTree = params->queryPropTree("Attributes");
  //Todo: if name attribute given in @selector
  //const char* selector = params->queryProp("@selector");
  const char* selectorKey = params->queryProp("@selector-key");

  if (selectorKey)
  {
      const char* dirPath = pAttrsTree->queryProp("Attribute[1]/@value");
      setCategoryAttributes(envTree, selectorKey, dirPath);
  }
  else
  {
    Owned<IPropertyTreeIterator> attrsIter = pAttrsTree->getElements("Attribute");
    ForEach(*attrsIter)
    {
      IPropertyTree* pAttrTree = &attrsIter->query();
      const char* dirName = pAttrTree->queryProp("@name");
      const char* dirPath = pAttrTree->queryProp("@value");
      setCategoryAttributes(envTree, dirName, dirPath);
    }
  }

  //query id
}
예제 #3
0
void SWProcess::computerUpdated(IPropertyTree *computerNode, const char* oldName,
     const char* oldIp, const char* instanceXMLTagName)
{
   IPropertyTree *software = m_envHelper->getEnvTree()->queryPropTree("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(XML_ATTR_NAME) && !stricmp(instance->queryProp(XML_ATTR_NAME), oldName))
         {
            if (stricmp(computerNode->queryProp(XML_ATTR_NAME), instance->queryProp(XML_ATTR_NAME)))
               instance->setProp(XML_ATTR_NAME, computerNode->queryProp(XML_ATTR_NAME));
            if (instance->hasProp(m_ipAttribute.str()) && stricmp(computerNode->queryProp(XML_ATTR_NETADDRESS), instance->queryProp(m_ipAttribute.str())))
               instance->setProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
            if (instance->hasProp("@computer") && stricmp(computerNode->queryProp(XML_ATTR_NAME), instance->queryProp("@computer")))
               instance->setProp("@computer", computerNode->queryProp(XML_ATTR_NAME));
         }
         else if (instance->hasProp(m_ipAttribute.str()) && !stricmp(instance->queryProp(m_ipAttribute.str()), oldIp))
         {
            instance->setProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
         }
      }
   }
}
//---------------------------------------------------------------------------
// 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;
}
예제 #5
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;
}
예제 #6
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");
 }
예제 #7
0
void SWProcess::checkInstanceAttributes(IPropertyTree *instanceNode, IPropertyTree *parent)
{
   assert(instanceNode);
   if (portIsRequired() && !instanceNode->hasProp("@port"))
   {
      int port = getDefaultPort();
      if (!port)
         throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss port attribute in instance");
      instanceNode->addPropInt("@port", port);
   }

   StringBuffer xpath;
   xpath.clear().appendf("xs:element/xs:complexType/xs:sequence/xs:element[@name=\"%s\"]",m_instanceElemName.str());
   IPropertyTree * instanceSchemaNode = m_pSchema->queryPropTree(xpath.str());
   if (!instanceSchemaNode) return;

   bool needDirProp = false;
   Owned<IPropertyTreeIterator> attrIter = instanceSchemaNode->getElements("xs:complexType/xs:attribute");
   ForEach(*attrIter)
   {
      IPropertyTree * attr = &attrIter->query();
      const char *attrName = attr->queryProp("@name");
      if (!stricmp(attrName, "directory"))
      {
         needDirProp = true;
         continue;
      }

      const char *defaultValue = attr->queryProp("@default");
      if (!defaultValue) continue;
      xpath.clear().appendf("@%s", attrName);
      if (instanceNode->hasProp(xpath.str())) continue;
      const char *use = attr->queryProp("@use");
      if (!use || !stricmp(use, "required")  || !stricmp(use, "optional"))
      {
         StringBuffer sbDefaultValue;
         sbDefaultValue.clear().append(defaultValue);
         sbDefaultValue.replaceString("\\", "\\\\");
         instanceNode->addProp(xpath.str(), sbDefaultValue.str());
       }
   }

   if (needDirProp && !instanceNode->hasProp("@directory"))
   {
      const IProperties *props = m_envHelper->getEnvConfigOptions().getProperties();
      StringBuffer sb;
      sb.clear().appendf("%s/%s",
         props->queryProp("runtime"), parent->queryProp(XML_ATTR_NAME));
      instanceNode->addProp("@directory", sb.str());
   }
}
//---------------------------------------------------------------------------
// check
//---------------------------------------------------------------------------
void CEspDeploymentEngine::check()
{
   CDeploymentEngine::check();

   // Make sure all protocol and service referenced by bindings are valid
   Owned<IPropertyTreeIterator> iter = m_process.getElements("EspBinding");
   for (iter->first(); iter->isValid(); iter->next())
   {
      IPropertyTree* pBinding = &iter->query();
      const char* service = pBinding->queryProp("@service");

      if (service)
      {
         if (!lookupProcess("EspService", service))
            throw MakeStringException(0, "Process %s references unknown service %s", m_name.get(), service);
      }
      else
         throw MakeStringException(-1, "The ESP binding %s for ESP %s has missing service information!", 
                                   pBinding->queryProp("@name"), m_name.get());
   }

   // Make sure DaliServers are valid
   iter.setown(m_process.getElements(".//*[@daliServers]"));
   ForEach(*iter)
   {
      const char* name = iter->query().queryProp("@daliServers");
      if (name && *name && !lookupProcess("DaliServerProcess", name))
            throw MakeStringException(0, "Process %s references unknown DaliServers %s", m_name.get(), name);
   }

   // Make sure EclServer is valid
   iter.setown(m_process.getElements(".//*[@eclServer]"));
   ForEach(*iter)
   {
      const char* name = iter->query().queryProp("@eclServer");
      if (name && *name && !lookupProcess("EclServerProcess", name))
         throw MakeStringException(0, "Process %s references unknown EclServer %s", m_name.get(), name);
   }

   // Make sure AttributeServer is valid
   iter.setown(m_process.getElements(".//*[@attributeServer]"));
   ForEach(*iter)
   {
      const char* name = iter->query().queryProp("@attributeServer");
      if (name && *name && !lookupProcess("AttrServerProcess", name))
         throw MakeStringException(0, "Process %s references unknown AttributeServer %s", m_name.get(), name);
   }
}
예제 #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;
}
예제 #10
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;
}
예제 #11
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");
}
예제 #12
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);
      }
   }
}
예제 #13
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>");
         }
     }
 }
예제 #14
0
bool CLogThread::FlattenTree(IArrayOf<IEspLogInfo>& valueArray,IPropertyTree& tree,StringBuffer& RootName)
{
    StringBuffer Value,Name;
    if (tree.hasChildren() == true)
    {

        Owned<IPropertyTreeIterator> itr =  tree.getElements("*");
        itr->first();
        while(itr->isValid())
        {
            IPropertyTree &node = itr->query();
            if(RootName.length() > 0)
                Name.appendf("%s_",RootName.str());
            Name.appendf("%s",node.queryName());

            if (node.hasChildren() == true)
            {
                if(IsArray(node)==true)
                    FlattenArray(valueArray,node,Name);
                else
                    FlattenTree(valueArray,node,Name);
            }
            else
            {
                const char* _value = tree.queryProp(node.queryName());
                if(tree.hasProp(node.queryName())==true && _value!=0 && _value!='\0')
                {
                    Value.appendf("%s",tree.queryProp(node.queryName()));
                    IClientLogInfo& logElement = addLogInfoElement(valueArray);
                    logElement.setName(Name.str());
                    logElement.setValue(Value.str());
                    //DBGLOG("Add log element: %s, %s", Name.str(), Value.str());
                    Value.clear();
                }
            }
            Name.clear();
            itr->next();
        }

    }
    else
    {
        return false;
    }
    return true;
}
예제 #15
0
CLocalDataLogger::CLocalDataLogger(IPropertyTree *cfg, const char *process, const char *service, const char* UrlRoot)
{
    StringBuffer _directoryCache,xpath;
    
    xpath.appendf("Software/EspProcess[@name=\"%s\"]/EspService[@name=\"%s\"]/localCache/", process, service);
    IPropertyTree* cacheprop = cfg->queryBranch(xpath.str());
    if(cacheprop==0)
    {
        WARNLOG(-1,"No local cache defined for %s service.",service);
        return;
    }
    Init(cacheprop->queryProp("@cache"),cacheprop->queryProp("@fileExtension"),UrlRoot,cacheprop->getPropInt("@timerPeriod"),cacheprop->getPropInt("@cacheTimeout"));




}
예제 #16
0
void SWProcess::processNameChanged(const char* process, const char *newName, const char* oldName)
{
   StringBuffer xpath;
   xpath.clear().appendf("@%s", process);
   IPropertyTree * swTree = m_envHelper->getEnvTree()->queryPropTree("/Software");
   Owned<IPropertyTreeIterator> compIter =  swTree->getElements(m_envHelper->getXMLTagName(m_name.str()));
   synchronized block(mutex);
   ForEach(*compIter)
   {
      IPropertyTree * compTree = &compIter->query();
      if ((oldName != NULL) && strcmp(oldName, compTree->queryProp(xpath.str())))
         continue;

      if (compTree->queryProp(xpath.str()))
         compTree->setProp(xpath.str(), newName);
   }
}
예제 #17
0
bool XmlEclRepository::doLoadModule(IPropertyTree * repository, IHqlRemoteScope * rScope, IErrorReceiver *errs)
{
    IHqlScope * scope = rScope->queryScope();
    const char * scopeName = scope->queryName()->getAtomNamePtr();

    StringBuffer s;
    const char * modName = scope->queryFullName();
    IPropertyTree* module = repository->queryPropTree(s.append("./Module[@name=\"").append(modName).append("\"]").str());
    if(!module)
    {
        if (logging())
            DBGLOG("No data for module %s",scopeName);
        return false;
    }
    int access = module->getPropInt("@access",cs_full);

    if(module->queryProp("Text"))
    {
        const char * path = module->queryProp("@sourcePath");
        Owned<ISourcePath> sourcePath = createSourcePath(path ? path : modName);
        Owned<IFileContents> text = createFileContentsFromText(module->queryProp("Text"), sourcePath);
        rScope->setText(text);
    }
    else
    {
        StringBuffer buf("./Attribute");
        Owned<IPropertyTreeIterator> it = module->getElements(buf.str());
        if (it->first())
        {
            for(;it->isValid();it->next())
            {
                Owned<IHqlExpression> item = toNamedSymbol(&it->query(), *scope->queryName(), access);
                ((CHqlScope*)scope)->defineSymbol(LINK(item));
            }
        }
        else
        {
            if (logging())
                DBGLOG("No definitions were added for module %s", scopeName);
        }
    }
    return true;
}
예제 #18
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());
}
예제 #19
0
bool SWProcess::portIsRequired()
{
   IPropertyTree * portAttrNode =  getPortDefinition();
   if (!portAttrNode) return false;

   const char* portUseAttr = portAttrNode->queryProp("@use");
   if (portUseAttr && stricmp(portUseAttr, "required"))
      return false;

   return true;
}
예제 #20
0
void ResourceManager::addManifestInclude(IPropertyTree &include, const char *dir)
{
    StringBuffer includePath;
    makeAbsolutePath(include.queryProp("@filename"), dir, includePath);
    VStringBuffer xpath("Include[@originalFilename='%s']", includePath.str());
    if (manifest->hasProp(xpath.str()))
        return;
    include.setProp("@originalFilename", includePath.str());
    manifest->addPropTree("Include", LINK(&include));
    addManifestFile(includePath.str());
}
예제 #21
0
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);
      }
   }
}
예제 #22
0
IPropertyTree * SWProcess::findInstance(IPropertyTree *comp, IPropertyTree *computerNode)
{
   Owned<IPropertyTreeIterator> instanceIter = comp->getElements(m_instanceElemName);
   ForEach (*instanceIter)
   {
      IPropertyTree * instance = &instanceIter->query();
      if (!stricmp(instance->queryProp("@computer"), computerNode->queryProp(XML_ATTR_NAME)))
         return instance;
   }

   return NULL;
}
예제 #23
0
bool CBuildSetManager::populateBuildSet()
{
    StringBuffer xpath;

    if (m_buildSetTree.get() != nullptr)
        return false;

    try
    {
        m_buildSetTree.set(createPTreeFromXMLFile(m_buildSetPath.str()));
    }
    catch(...)
    {
        return false;
    }

    xpath.setf("./%s/%s/%s", XML_TAG_PROGRAMS, XML_TAG_BUILD, XML_TAG_BUILDSET);

    Owned<IPropertyTreeIterator> iter = m_buildSetTree->getElements(xpath.str());

    ForEach(*iter)
    {
        IPropertyTree* pTree = &iter->query();

        if ( pTree->queryProp(XML_ATTR_PROCESS_NAME) == nullptr || pTree->queryProp(XML_ATTR_OVERRIDE) != nullptr || ( (pTree->queryProp(XML_ATTR_DEPLOYABLE) != nullptr && \
                stricmp(pTree->queryProp(XML_ATTR_DEPLOYABLE), "no") == 0 && stricmp(pTree->queryProp(XML_ATTR_PROCESS_NAME), XML_TAG_ESPSERVICE) != 0) ) )
            continue;

        Owned<CBuildSet> pBuildSet = new CBuildSet(pTree->queryProp(XML_ATTR_INSTALLSET), pTree->queryProp(XML_ATTR_NAME), pTree->queryProp(XML_ATTR_PROCESS_NAME),\
                                                   pTree->queryProp(XML_ATTR_SCHEMA), pTree->queryProp(XML_ATTR_DEPLOYABLE), pTree->queryProp(XML_ATTR_OVERRIDE));

        m_buildSetArray.append(*pBuildSet.getLink());
    }
    return true;
}
예제 #24
0
static void appendNodeEndpoint(IPropertyTree& node,SocketEndpointArray &eps)
{
    const char *computer = node.queryProp("@computer");
    CMachineEntryPtr *m = machinemap.getValue(computer);
    if (!m) {
        ERRLOG("Computer name %s not found",computer);
        return;
    }
    SocketEndpoint ep = (*m)->ep;
    if (ep.port==0)
        ep.port = getDaliServixPort();
    eps.append(ep);
}
//---------------------------------------------------------------------------
// copyInstallFiles
//---------------------------------------------------------------------------
void CDaliDeploymentEngine::copyInstallFiles(IPropertyTree& instanceNode, const char* destPath)
{
    const char* computer = instanceNode.queryProp("@computer");
   if ((m_deployFlags & DEFLAGS_CONFIGFILES) && computer && *computer)
   {
      // Create dalisds.xml is not already exists
      StringBuffer hostRoot(getHostRoot(computer, NULL));

      const char* dir = m_process.queryProp("@dataPath");
      if (!dir || !*dir)
         dir = instanceNode.queryProp("@directory");

      if (dir)
      {
         if (isPathSepChar(*dir))
            dir++;
         StringBuffer sDir( dir );
         sDir.replace(':', '$');
         sDir.replace('/', '\\');
         sDir.insert(0, hostRoot.str());

         if (!checkFileExists( sDir.str() ))
         {
            Owned<IPropertyTree> tree = &m_environment.getPTree();
            StringBuffer xml("<SDS>");
            toXML(tree, xml);
            xml.append("</SDS>");

            sDir.append( "\\dalisds.xml" );
            writeFile(sDir.str(), xml.str());
         }
      }
   }
   // Copy install files to deploy subdir
   CDeploymentEngine::copyInstallFiles(instanceNode, destPath);
}
예제 #26
0
IPropertyTree * SWProcess::addComponent(IPropertyTree *params)
{
  const char* clone = params->queryProp("@clone");
  if (clone)
  {
     return SWComponentBase::cloneComponent(params);
  }

  IPropertyTree * pCompTree = SWComponentBase::addComponent(params);
  if (pCompTree->hasProp("@daliServers") &&  !strcmp(pCompTree->queryProp("@daliServers"), ""))
  {
     IPropertyTree * envTree = m_envHelper->getEnvTree();
     StringBuffer xpath;
     xpath.clear().appendf(XML_TAG_SOFTWARE "/DaliServerProcess/@name");
     const char *daliName = envTree->queryProp(xpath.str());
     if (daliName)
     {
        pCompTree->setProp("@daliServers", daliName);
     }
  }

  removeInstancesFromComponent(pCompTree);
  return pCompTree;
}
예제 #27
0
IConfigComp* SWProcess::getInstanceNetAddresses(StringArray& ipList, const char* clusterName)
{
  IPropertyTree * envTree = m_envHelper->getEnvTree();
  StringBuffer xpath;
  if (clusterName)
     xpath.clear().appendf(XML_TAG_SOFTWARE "/%s[@name=\"%s\"]", m_processName.str(), clusterName);
  else
     xpath.clear().appendf(XML_TAG_SOFTWARE "/%s[1]", m_processName.str());

  IPropertyTree *compTree = envTree->queryPropTree(xpath.str());

  Owned<IPropertyTreeIterator> iter = compTree->getElements(m_instanceElemName.str());
  ForEach (*iter)
  {
     IPropertyTree *instance = &iter->query();
     ipList.append(instance->queryProp("@netAddress"));

  }
  return (IConfigComp*)this;
}
예제 #28
0
static bool checkScopeAuthorized(IUserDescriptor *user,IPropertyTree &pt,bool &securitydisabled)
{
    if (securitydisabled)
        return true;
    unsigned auditflags = DALI_LDAP_AUDIT_REPORT|DALI_LDAP_READ_WANTED;
    int perm = 255;
    const char *scopename = pt.queryProp("@scope");
    if (scopename&&*scopename) {
        perm = querySessionManager().getPermissionsLDAP("workunit",scopename,user,auditflags);
        if (perm<0) {
            if (perm==-1) {
                perm = 255;
                securitydisabled = true;
            }
            else 
                perm = 0;
        }
        if (!HASREADPERMISSION(perm)) 
            return false;

    }
    return true;
}
예제 #29
0
void SWProcess::modifyInstance(IPropertyTree *parent, IPropertyTree *params)
{
   IPropertyTree* pAttrs = params->queryPropTree("Attributes");
   if (!pAttrs)
      throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss instance attributes input");

   const char * instanceXMLTagName = getInstanceXMLTagName(pAttrs->queryProp("@selector"));
   Owned<IPropertyTreeIterator> iter = pAttrs->getElements("Attribute");
   ForEach (*iter)
   {
      IPropertyTree *attr = &iter->query();
      const char* propName = attr->queryProp("@name");
      if (stricmp(propName, "ip"))
         continue;

      StringBuffer xpath;
      IPropertyTree *instanceToModify;
      const char* oldIp = attr->queryProp("@oldValue");
      if ((!oldIp || !(*oldIp)) && m_singleInstanceList.find(m_name.str()) == NotFound)
         throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss instance  current ip to change");
      else if (oldIp && *oldIp)
      {
         xpath.clear().appendf("%s[%s=\"%s\"]", instanceXMLTagName, m_ipAttribute.str(), oldIp);
         instanceToModify = parent->queryPropTree(xpath.str());
      }
      else
      {
         xpath.clear().appendf("%s[1]", instanceXMLTagName);
         instanceToModify = parent->queryPropTree(xpath.str());
      }

      if (!instanceToModify)
         throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Cannot find instance node to modify");

      IPropertyTree * computerNode = addComputer(attr->queryProp("@value"));
      instanceToModify->setProp("@computer", computerNode->queryProp(XML_ATTR_NAME));

      instanceToModify->setProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
  }

}
예제 #30
0
inline bool isPartTLK(IPropertyTree &pt) { const char *kind = pt.queryProp("@kind"); return kind&&strieq(kind,"topLevelKey"); }