コード例 #1
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);
   }
}
コード例 #2
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;
}
コード例 #3
0
IPropertyTree *CEspBinding::ensureNavDynFolder(IPropertyTree &root, const char *name, const char *tooltip, const char *params, const char *menuname)
{
    StringBuffer xpath;
    xpath.appendf("DynamicFolder[@name=\"%s\"]", name);

    IPropertyTree *ret = root.queryPropTree(xpath.str());
    if (!ret)
    {
        ret=createPTree("DynamicFolder");
        ret->addProp("@name", name);
        ret->addProp("@tooltip", tooltip);
        ret->addProp("@params", params);
        ret->setProp("@menu", menuname);
        root.addPropTree("DynamicFolder", ret);
    }
    return ret;
}
コード例 #4
0
ファイル: espcfg.cpp プロジェクト: Josh-Googler/HPCC-Platform
void CEspConfig::initPtree(const char *location, bool isDali)
{
    IPropertyTree* cfg = createPTreeFromXMLFile(location, ipt_caseInsensitive);
    if (cfg)
    {
        cfg->addProp("@config", location);
        m_envpt.setown(cfg);
    }
}
コード例 #5
0
void SWProcess::addInstance(IPropertyTree *computerNode, IPropertyTree *parent, IPropertyTree *attrs, const char* instanceXMLTagName)
{

   IPropertyTree *instanceNode = NULL;
   StringBuffer xpath;
   if (m_singleInstanceList.find(m_name.str()) != NotFound)
   {
      xpath.clear().appendf("%s[1]", instanceXMLTagName);
      instanceNode = parent->queryPropTree(xpath.str());
   }
   else
   {
      instanceNode = findInstance(parent, computerNode);
   }

   if (!instanceNode)
   {
      // create instance
      instanceNode = createPTree(instanceXMLTagName);
      instanceNode->addProp("@computer", computerNode->queryProp(XML_ATTR_NAME));
      // get unique name

      StringBuffer sbName;
      if (String(instanceXMLTagName).indexOf("Master") > 0)
         sbName.append("m");
      else
         sbName.append("s");

      instanceNode->addProp(XML_ATTR_NAME, getUniqueName(parent, sbName, instanceXMLTagName, ""));
      instanceNode->addProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
      parent->addPropTree(instanceXMLTagName, instanceNode);
   }

   StringArray excludeList;
   excludeList.append("ip");
   excludeList.append("ipfile");
   if (attrs)
      updateNode(instanceNode, attrs, &excludeList);

   checkInstanceAttributes(instanceNode, parent);

}
コード例 #6
0
IPropertyTree *CEspBinding::ensureNavFolder(IPropertyTree &root, const char *name, const char *tooltip, const char *menuname, bool sort, unsigned relPosition)
{
    StringBuffer xpath;
    xpath.appendf("Folder[@name=\"%s\"]", name);

    IPropertyTree *ret = root.queryPropTree(xpath.str());
    if (!ret)
    {
        ret=createPTree("Folder");
        ret->addProp("@name", name);
        ret->addProp("@tooltip", tooltip);
        ret->setProp("@menu", menuname);
        if (sort)
            ret->addPropBool("@sort", true);
        ret->addPropInt("@relPosition", relPosition);

        root.addPropTree("Folder", ret);
    }

    return ret;
}
コード例 #7
0
IPropertyTree *CEspBinding::ensureNavMenu(IPropertyTree &root, const char *name)
{
    StringBuffer xpath;
    xpath.appendf("Menu[@name=\"%s\"]", name);

    IPropertyTree *ret = root.queryPropTree(xpath.str());
    if (!ret)
    {
        ret=createPTree("Menu");
        ret->addProp("@name", name);
        root.addPropTree("Menu", ret);
    }
    return ret;
}
コード例 #8
0
   //---------------------------------------------------------------------------
   //  addTask
   //---------------------------------------------------------------------------
   IPropertyTree* addTask(IDeployTask& task)
   {
      // Get or add Component node
      IPropertyTree* compNode = addComponent(task.getCompName());
      assertex(compNode);

      // Get Tasks node
      IPropertyTree* tasksNode = compNode->queryPropTree("Tasks");
      assertex(tasksNode);

      // Add new task
      IPropertyTree* node = createPTree("Task");
      node->addProp("@action", task.getCaption());
      node->addProp("@source", task.getFileSpec(DT_SOURCE));
      node->addProp("@target", task.getFileSpec(DT_TARGET));

      CDateTime modifiedTime;
      Owned<IFile> pTargetFile = createIFile(task.getFileSpec(DT_TARGET));
      
      if (pTargetFile->getTime(NULL, &modifiedTime, NULL))
      {
         StringBuffer timestamp;
         modifiedTime.getString(timestamp);
         offset_t filesize = pTargetFile->size();

         node->addProp("@date", timestamp.str());
         node->addPropInt64("@size", filesize);
      }

      if (task.getErrorCode())
      {
         node->addProp("@error", task.getErrorString());
         compNode->setProp("@error", "true");
      }
      return tasksNode->addPropTree("Task", node);
   }
コード例 #9
0
   //---------------------------------------------------------------------------
   //  addDirList
   //---------------------------------------------------------------------------
   IPropertyTree* addDirList(const char* comp, const char* path)
   {
      // Get or add Component node
      IPropertyTree* compNode = addComponent(comp);
      assertex(compNode);

      // Add new Directory node
      assertex(path);
      char ppath[_MAX_PATH];
      strcpy(ppath, path);
      removeTrailingPathSepChar(ppath);
      IPropertyTree* node = createPTree("Directory");
      node->addProp("@name", ppath);
      getDirList(ppath, node);
      return compNode->addPropTree("Directory", node);
   }
コード例 #10
0
ファイル: EnvGen.cpp プロジェクト: AttilaVamos/HPCC-Platform
bool CEnvGen::parseArgs(int argc, char** argv)
{
   int i = 1;

   //m_params = createPTree("Env");
   m_params.setown(createPTree("Env"));
   IPropertyTree * config = createPTree("Config");
   m_params->addPropTree("Config", config);

   while (i < argc)
   {
     if (stricmp(argv[i], "-help") == 0 || stricmp(argv[i], "-?") == 0)
     {
        usage();
        return false;
     }
     else if (stricmp(argv[i], "-mode") == 0)
     {
        i++;
        config->setProp("@mode", argv[i++]);
     }
     else if ((stricmp(argv[i], "-env") == 0) || (stricmp(argv[i], "-env-out") == 0))
     {
        i++;
        config->addProp("@env-out", argv[i++]);
     }
     else if (stricmp(argv[i], "-env-in") == 0)
     {
        i++;
        config->addProp("@env-in", argv[i++]);
     }
     else if (stricmp(argv[i], "-ip") == 0)
     {
        i++;
        config->addProp("@ip-list", argv[i++]);
     }
     else if (stricmp(argv[i], "-ipfile") == 0)
     {
        i++;
        config->addProp("@ip-file", argv[i++]);
     }
     else if (stricmp(argv[i], "-supportnodes") == 0)
     {
        i++;
        config->addProp("@support-nodes", argv[i++]);
     }
     else if (stricmp(argv[i], "-espnodes") == 0)
     {
        i++;
        config->addProp("@esp-nodes", argv[i++]);
     }
     else if (stricmp(argv[i], "-roxienodes") == 0)
     {
        i++;
        config->addProp("@roxie-nodes", argv[i++]);
     }
     else if (stricmp(argv[i], "-thornodes") == 0)
     {
        i++;
        config->addProp("@thor-nodes", argv[i++]);
     }
     else if (stricmp(argv[i], "-slavespernode") == 0)
     {
        i++;
        config->addProp("@slaves-per-node", argv[i++]);
     }
     else if (stricmp(argv[i], "-thorchannelsperslave") == 0)
     {
        i++;
        config->addProp("@thor-channels-per-slave", argv[i++]);
     }
     else if (stricmp(argv[i], "-roxiechannelsperslave") == 0)
     {
        i++;
        config->addProp("@roxie-channels-per-slave", argv[i++]);
     }
     else if (stricmp(argv[i], "-roxieondemand") == 0)
     {
        i++;
        if (!strcmp(argv[i++], "0"))
           config->addProp("@roxie-on-demand", "false");
     }
     else if (stricmp(argv[i], "-o") == 0)
     {
        i++;
        StringArray sbarr;
        sbarr.appendList(argv[i++], "=");
        if (sbarr.length() != 2)
           continue;
        if (strstr(sbarr.item(1), "[NAME]") && (strstr(sbarr.item(1), "[INST]") || strstr(sbarr.item(1), "[COMPONENT]")))
        {
           StringBuffer sb;
           sb.clear().appendf("sw:dirs:category@%s=%s",sbarr.item(0), sbarr.item(1));
           createUpdateTask("modify", config, sb.str());
        }
        else
        {
           fprintf(stderr, "Error: Directory Override must contain [NAME] and either [INST] or [COMPONENT]\n");
           return false;
        }

     }
     else if (stricmp(argv[i], "-override") == 0)
     {
        i++;
        if (!convertOverrideTask(config, argv[i++]))
           return false;
     }
     else if (stricmp(argv[i], "-set-xpath-attrib-value")== 0)
     {
        i++;
        m_arrXPaths.append(*new StringBufferItem (argv[i++]));
        m_arrAttrib.append(*new StringBufferItem (argv[i++]));
        m_arrValues.append(*new StringBufferItem (argv[i++]));
     }

     // new parameters
     else if (stricmp(argv[i], "-env-options") == 0)
     {
        i++;
        config->addProp("@options", argv[i++]);
     }
     else if (stricmp(argv[i], "-env-rules") == 0)
     {
        i++;
        config->addProp("@rules", argv[i++]);
     }
     else if (stricmp(argv[i], "-buildset") == 0)
     {
        i++;
        config->addProp("@buildset", argv[i++]);
     }
     else if (stricmp(argv[i], "-add") == 0)
     {
       i++;
       createUpdateTask("add", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-mod") == 0)
     {
       i++;
       createUpdateTask("modify", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-rmv") == 0)
     {
       i++;
       createUpdateTask("remove", config, argv[i++]);
     }

     else if (stricmp(argv[i], "-add-node") == 0)
     {
       i++;
       createUpdateNodeTask("add", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-mod-node") == 0)
     {
       i++;
       createUpdateNodeTask("modify", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-rmv-node") == 0)
     {
       i++;
       createUpdateNodeTask("remove", config, argv[i++]);
     }

     else if (stricmp(argv[i], "-add-binding") == 0)
     {
       i++;
       createUpdateBindingTask("add", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-mod-binding") == 0)
     {
       i++;
       createUpdateBindingTask("modify", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-rmv-binding") == 0)
     {
       i++;
       createUpdateBindingTask("remove", config, argv[i++]);
     }

     else if (stricmp(argv[i], "-add-service") == 0)
     {
       i++;
       createUpdateServiceTask("add", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-mod-service") == 0)
     {
       i++;
       createUpdateServiceTask("modify", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-rmv-service") == 0)
     {
       i++;
       createUpdateServiceTask("remove", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-add-topology") == 0)
     {
       i++;
       createUpdateTopologyTask("add", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-mod-topology") == 0)
     {
       i++;
       createUpdateTopologyTask("modify", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-rmv-topology") == 0)
     {
       i++;
       createUpdateTopologyTask("remove", config, argv[i++]);
     }
     else if (stricmp(argv[i], "-in-file") == 0)
     {
       i++;
       addUpdateTaskFromFile(argv[i++]);
     }
     else if (stricmp(argv[i], "-add-content")== 0)
     {
        i++;
        m_arrContentXPaths.append(*new StringBufferItem (argv[i++]));
        const char* fileName = argv[i++];
        StringBufferItem * sbi = new StringBufferItem() ;
        sbi->loadFile(fileName);
        m_arrContents.append(*sbi);
        if ((String(fileName).toLowerCase())->endsWith(".json"))
           m_arrContentFormats.append(*new StringBufferItem("json"));
        else
           m_arrContentFormats.append(*new StringBufferItem("xml"));

     }
     else if (stricmp(argv[i], "-show-input-only") == 0)
     {
        i++;
        m_showInputOnly = true;
        m_displayFormat = XML_Format;
     }
     else if (stricmp(argv[i], "-show-input-json-only") == 0)
     {
        i++;
        m_showInputOnly = true;
        m_displayFormat = JSON_Format;
     }
     else if (stricmp(argv[i], "-help-update-1") == 0)
     {
        usage_update_input_format_1();
        return false;
     }
     else if (stricmp(argv[i], "-help-update-2") == 0)
     {
		usage_update_input_format_2();
        return false;
     }
     else if (stricmp(argv[i], "-help-update-3") == 0)
     {
        usage_update_input_format_3();
        return false;
     }
     else if (stricmp(argv[i], "-help-update-3-json") == 0)
     {
        usage_update_input_format_3_json();
        return false;
     }
     else if (stricmp(argv[i], "-cloud") == 0)
     {
        i++;
        cloudConfiguration(config, argv[i++]);
     }
     else
     {
        fprintf(stderr, "\nUnknown option %s\n", argv[i]);
        usage();
        return false;
     }
   }

   // Check input parameters
   if (!config->queryProp("@env-out"))
   {
      fprintf(stderr, "\nMissing -env-out\n");
      usage();
      return false;
   }

   if (!config->queryProp("@mode"))
   {
      if (config->queryProp("@env-in"))
         config->addProp("@mode", "update");
      else
         config->addProp("@mode", "create");
   }

   if (!stricmp(config->queryProp("@mode"), "update") &&
       !config->queryProp("@env-in"))
   {
       fprintf(stderr, "\nMissing input enviroment.xml (-env-in) in update mode\n");
       return false;
   }

   if (!stricmp(config->queryProp("@mode"), "create") &&
       !config->hasProp("@ip-list")  && !config->hasProp("@ip-file"))
   {
      config->setProp("@support-nodes", "0");
      config->setProp("@roxie-nodes", "0");
      config->setProp("@thor-nodes", "0");
      config->setProp("@esp-nodes", "0");
   }


   m_iConfigEnv =  ConfigEnvFactory::getIConfigEnv(config);

   return true;
}
コード例 #11
0
ファイル: EnvGen.cpp プロジェクト: AttilaVamos/HPCC-Platform
void CEnvGen::createUpdateTask(const char* action, IPropertyTree * config, const char* param)
{
   if (!param || !(*param)) return;

   if (m_showInputOnly)
   {
      printf("Input as one line format: -%s %s\n", (m_actionAbbrMap.at(action)).c_str(), param);
   }

   StringArray items;
   items.appendList(param, ":");
   if (items.ordinality() < 2)
   {
      throw MakeStringException(CfgEnvErrorCode::InvalidParams,
         "Incorrect input format. At least two item expected: category:component.\n See usage for deail.");
   }

   IPropertyTree * updateTree =  createPTree("Task");
   config->addPropTree("Task", updateTree);

   updateTree->addProp("@operation", action);
   updateTree->addProp("@category", (m_envCategoryMap.at(items.item(0))).c_str());

   //have key and attributes
   StringArray compAndAttrs;
   compAndAttrs.appendList(items.item(1), "@");

   StringArray compAndTarget;
   compAndTarget.appendList(compAndAttrs[0], "%");
   if (!stricmp(action, "remove") && compAndTarget.ordinality() > 1 )
   {
      if (*(compAndTarget.item(1))) updateTree->addProp("@target", compAndTarget.item(1));
   }

   StringArray compAndKey;
   compAndKey.appendList(compAndTarget.item(0), "#");

   updateTree->addProp("@component", compAndKey.item(0));

   if (compAndKey.ordinality() > 1)
   {
      StringArray keyAndClone;
      keyAndClone.appendList(compAndKey.item(1), ATTR_V_SEP);
      updateTree->addProp("@key", keyAndClone.item(0));
      if (keyAndClone.ordinality() > 1)
         updateTree->addProp("@clone", keyAndClone.item(1));
   }

   if (compAndAttrs.ordinality() > 1)
   {
      addUpdateAttributesFromString(updateTree, compAndAttrs.item(1));
      return;
   }

   if (items.ordinality() == 2)
      return;

   int index = 2;

   // selector
   StringArray selectorAndAttrs;
   selectorAndAttrs.appendList(items.item(index), "@");

   StringArray selectorParts;
   selectorParts.appendList(selectorAndAttrs.item(0), "/");

   StringBuffer sbSelector;
   for ( unsigned i = 0; i < selectorParts.ordinality()-1 ; i++)
   {
       if (!sbSelector.isEmpty())
          sbSelector.append("/");
       sbSelector.append(selectorParts.item(i));
   }

   StringArray selectorAndKey;
   selectorAndKey.appendList(selectorParts.item(selectorParts.ordinality()-1), "#");
   if (!sbSelector.isEmpty())
      sbSelector.append("/");
   sbSelector.append(selectorAndKey.item(0));
   sbSelector.replace('#', '@');

   updateTree->addProp("@selector", sbSelector.str());
   if (selectorAndKey.ordinality() > 1)
      updateTree->addProp("@selector-key", selectorAndKey.item(1));

   if (selectorAndAttrs.ordinality() > 1)
   {
      addUpdateAttributesFromString(updateTree, selectorAndAttrs.item(1));
   }

   index++;
   if (items.ordinality() == index) return;

   // children nodes
   IPropertyTree *children = updateTree->addPropTree("Children", createPTree("Children"));
   for ( unsigned i = index; i < items.ordinality() ; i++)
   {
       IPropertyTree *child = children->addPropTree("Child", createPTree("Child"));
       StringArray nameAndAttrs;
       nameAndAttrs.appendList(items.item(i), "@");
       child->addProp("@name", nameAndAttrs.item(0));
       if (nameAndAttrs.ordinality() > 1)
          addUpdateAttributesFromString(child, nameAndAttrs.item(1));
   }

}
コード例 #12
0
void SWEspProcess::addBinding(IPropertyTree *parent, IPropertyTree * attrs)
{
   StringBuffer xpath;
   xpath.clear().append("Attribute[@name='name']/@value");
   const char * bindingName = attrs->queryProp(xpath);
   if (!bindingName || !(*bindingName))
         throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss esp binding name in adding binding");

   xpath.clear().append("Attribute[@name='service']/@value");
   const char * serviceName = attrs->queryProp(xpath);
   if (!serviceName || !(*serviceName))
         throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss esp service name in adding binding");

   IPropertyTree * envTree = m_envHelper->getEnvTree();
   xpath.clear().appendf(XML_TAG_SOFTWARE "/" XML_TAG_ESPSERVICE "[@name=\"%s\"]", serviceName);
   IPropertyTree * pEspService = envTree->queryPropTree(xpath.str());
   if (!pEspService)
   {
      const char* task="<Task category=\"Software\" component=\"esdl\" key=\"dynamicesdl\" operation=\"add\"/>";
      Owned<IPropertyTree> taskPT = createPTreeFromXMLString(task);
      ((SWEspService*)m_envHelper->getEnvSWComp("DynamicESDL"))->add(taskPT);
      pEspService = envTree->queryPropTree(xpath.str());
      assert(pEspService);
      // throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Can't find EspService with name %s.", serviceName);
   }

   IPropertyTree *pBinding = createPTree(XML_TAG_ESPBINDING);
   if (attrs)
      updateNode(pBinding, attrs, NULL);

   // check attributes

   if (!(pBinding->queryProp(XML_ATTR_PROTOCOL)))
      pBinding->addProp(XML_ATTR_PROTOCOL, "http");
   const char* protocol = pBinding->queryProp(XML_ATTR_PROTOCOL);

   if (!stricmp(protocol, "https"))
      xpath.clear().append("Properties/@defaultSecurePort");
   else
      xpath.clear().append("Properties/@defaultPort");

   const char* defaultPort = pEspService->queryProp(xpath.str());
   const char* port = pBinding->queryProp(XML_ATTR_PORT);
   if (!port || !(*port))
   {
      pBinding->addProp(XML_ATTR_PORT, defaultPort);
   }
   const char* defaultForPort = pBinding->queryProp("@defaultForPort");
   if (!stricmp(defaultPort, pBinding->queryProp(XML_ATTR_PORT)))
   {
      if (!defaultForPort || !(*defaultForPort) || !defaultForPort)
         pBinding->setProp("@defaultForPort", "true");
   }
   else
   {
      if (!defaultForPort || !(*defaultForPort) || defaultForPort)
         pBinding->setProp("@defaultForPort", "true");
   }


   if (!(pBinding->queryProp("@defaultServiceVersion")))
      pBinding->addProp("@defaultServiceVersion", "");

   if (!(pBinding->queryProp("@resourcesBasedn")))
      pBinding->addProp("@resourcesBasedn", pEspService->queryProp("Properties/@defaultResourcesBasedn"));

   if (!(pBinding->queryProp(XML_ATTR_TYPE)))
      pBinding->addProp(XML_ATTR_TYPE, "");

   if (!(pBinding->queryProp("@workunitsBasedn")))
      pBinding->addProp("@workunitsBasedn", "ou=workunits,ou=ecl");

   if (!(pBinding->queryProp("@wsdlServiceAddress")))
      pBinding->addProp("@wsdlServiceAddress", "");

   // Add AuthenticateFeature
   Owned<IPropertyTreeIterator> afIter = pEspService->getElements("Properties/AuthenticateFeature");
   ForEach (*afIter)
   {
      pBinding->addPropTree("AuthenticateFeature", m_envHelper->clonePTree(&afIter->query()));
   }

   // Add Authenticate
   Owned<IPropertyTreeIterator> authIter = pEspService->getElements("Properties/Authenticate");
   ForEach (*authIter)
   {
      pBinding->addPropTree("Authenticate", m_envHelper->clonePTree(&authIter->query()));
   }

   parent->addPropTree(XML_TAG_ESPBINDING, pBinding);
}
コード例 #13
0
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);
            }
        }

        //For Spray files on Thor Cluster, fetch all the group names for all the thor instances (and dedup them)
        BoolHash uniqueThorClusterGroupNames;
        it.setown(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();
}