Пример #1
0
/*------------------------------------------------------------------------
 *  resolve  -  do shorthand DNS name resolution
 *------------------------------------------------------------------------
 */
static IPaddr
resolve(char *nam)
{
    IPaddr	ip;
    char	myname[64];
    char	name_buf[100];
    char	*name_suffix;

    /* if it ends in a 'dot', remove it and try exactly once */
    if (nam[strlen(nam)-1] == '.') {
        strcpy(name_buf, nam);
        name_buf[strlen(name_buf)-1] = NULLCH;
        return gname(name_buf);
    }
    if (getname(myname) == SYSERR)
        return (IPaddr)SYSERR;
    name_suffix = myname;

    /* tack on successively smaller suffixes of MY name */
    while (name_suffix = index(++name_suffix, '.')) {
        sprintf(name_buf, "%s%s", nam, name_suffix);
        if ((ip = gname(name_buf)) != (unsigned) SYSERR)
            return ip;
    }
    return gname(nam);		/* try the original	*/
}
Пример #2
0
StarObject::StarObject( double r, double d, float m,
                        const QString &n, const QString &n2,
                        const QString &sptype, double pmra, double pmdec,
                        double par, bool mult, bool var, int hd )
    : SkyObject (SkyObject::STAR, r, d, m, n, n2, QString()),
      PM_RA(pmra), PM_Dec(pmdec),
      Parallax(par), Multiplicity(mult), Variability(var)
{
    QByteArray spt = sptype.toAscii();
    SpType[0] = spt[0];
    SpType[1] = spt[1];
    
    QString lname;
    if ( hasName() ) {
        lname = n;
        if ( hasName2() )lname += " (" + gname() + ')';
    } else if ( hasName2() ) {
        lname = gname();
        //If genetive name exists, but no primary name, set primary name = genetive name.
        setName( gname() );
    }

    HD = hd;    

    setLongName(lname);
    updateID = updateNumID = 0;
}
Пример #3
0
void StarObject::setNames( QString name, QString name2 ) {
    QString lname;

    setName( name );

    setName2( name2 );

    if ( hasName() ) {
        lname = name;
        if ( hasName2() ) lname += " (" + gname() + ')';
    } else if ( hasName2() )
        lname = gname();
    setLongName(lname);
}
Пример #4
0
int main(int argc, char*argv[])
{
    if(argc < 2)
    {
        std::cerr << "Required: filename.dot" << std::endl;
        return -1;
    }

    // Vertex properties
    typedef boost::property < boost::vertex_name_t, std::string,
            boost::property < boost::vertex_color_t, float > > vertex_p;
    // Edge properties
    typedef boost::property < boost::edge_weight_t, double > edge_p;
    // Graph properties
    typedef boost::property < boost::graph_name_t, std::string > graph_p;
    // adjacency_list-based type
    typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS,
            vertex_p, edge_p, graph_p > graph_t;

    // Construct an empty graph and prepare the dynamic_property_maps.
    graph_t graph(0);
    boost::dynamic_properties dp;

    boost::property_map<graph_t, boost::vertex_name_t>::type name =
        get(boost::vertex_name, graph);
    dp.property("node_id",name);

    boost::property_map<graph_t, boost::vertex_color_t>::type mass =
        get(boost::vertex_color, graph);
    dp.property("mass",mass);

    boost::property_map<graph_t, boost::edge_weight_t>::type weight =
        get(boost::edge_weight, graph);
    dp.property("weight",weight);

    // Use ref_property_map to turn a graph property into a property map
    boost::ref_property_map<graph_t*,std::string>
    gname(get_property(graph,boost::graph_name));
    dp.property("name",gname);

    /*
    // Sample graph as an std::istream;
    std::istringstream
      gvgraph("digraph { graph [name=\"graphname\"]  a  c e [mass = 6.66] }");

    bool status = boost::read_graphviz(gvgraph,graph,dp,"node_id");
    */

    std::string filename = argv[1];
    std::ifstream fin(filename.c_str());

    bool status = boost::read_graphviz(fin,graph,dp,"node_id");

    std::cout << "There are " << num_vertices(graph) << " vertices." << std::endl;

    return 0;
}
Пример #5
0
QString StarObject::nameLabel( bool drawName, bool drawMag ) const
{
    QString sName;
    if ( drawName ) {
        if ( translatedName() != i18n("star") && ! translatedName().isEmpty() )
            sName = translatedName();
        else if ( ! gname().trimmed().isEmpty() )
            sName = gname( true );
        else {
            if ( drawMag )
                return KGlobal::locale()->formatNumber( mag(), 1 );
        }
        if ( ! drawMag )
            return sName;
        else
            return sName + ' ' + KGlobal::locale()->formatNumber( mag(), 1 );
    }
    return KGlobal::locale()->formatNumber( mag(), 1 );
}
Пример #6
0
/*
 * gopen --
 *   Open a group of files low...lim.
 */
void gopen(FILE *infile[], int low, int lim)
{
     char name[NAMESIZE];
     int i;

     for (i = 0; i < lim-low+1; i++) {
          gname(low+i, name, NAMESIZE);
          infile[i] = fopen(name, "r");
     }
}
Пример #7
0
  void FWSingle::readInFloat(int step, vector<float>& data_out)
  {
    int RANK=1;

    hid_t       dataset;  
    hid_t       filespace;                   
    hid_t       memspace;                  
    hid_t       cparms;                   
    hsize_t     dims[2];                     /* dataset and chunk dimensions*/ 
    hsize_t     chunk_dims[1];
    hsize_t     col_dims[1];
    hsize_t     count[2];
    hsize_t     offset[2];

    herr_t      status, status_n;                             

    int         rank, rank_chunk;
    hsize_t hi, hj;


    c_file = H5Fopen(fname.str().c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
    stringstream gname("");

    gname<<"Block_"<< step;
    hid_t d_file = H5Gopen(c_file,gname.str().c_str());
    dataset = H5Dopen(d_file, "Positions");
    filespace = H5Dget_space(dataset); 
    rank = H5Sget_simple_extent_ndims(filespace);
    status_n  = H5Sget_simple_extent_dims(filespace, dims, NULL);
    //     if (verbose>1) printf("dataset rank %d, dimensions %lu x %lu\n", rank, (unsigned long)(dims[0]), (unsigned long)(dims[1]));
    data_out.resize(dims[0]);
    cparms = H5Dget_create_plist(dataset);
    if (H5D_CHUNKED == H5Pget_layout(cparms))  {
      rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims);
      //       if (verbose>1) printf("chunk rank %d, dimensions %lu \n", rank_chunk, (unsigned long)(chunk_dims[0]) );
    }
    memspace = H5Screate_simple(RANK,dims,NULL);

    status = H5Dread(dataset, H5T_NATIVE_FLOAT, memspace, filespace, H5P_DEFAULT, &(data_out[0]));
    if(verbose>2)
    {
      printf("\n");
      printf("Dataset: \n");
      for (int j = 0; j < dims[0]; j++) app_log()<<data_out[j]<<" ";
      app_log()<<endl;
    }

    H5Pclose(cparms);
    H5Dclose(dataset);
    H5Sclose(filespace);
    H5Sclose(memspace);

    H5Gclose(d_file);
    H5Fclose(c_file);
  }
Пример #8
0
void collectLocusData(GList<GenomicSeqData>& ref_data) {
  int locus_num=0;
  for (int g=0;g<ref_data.Count();g++) {
    GenomicSeqData* gdata=ref_data[g];
    for (int l=0;l<gdata->loci.Count();l++) {
      GffLocus& loc=*(gdata->loci[l]);
      GHash<int> gnames(true); //gene names in this locus
      GHash<int> geneids(true); //Entrez GeneID: numbers
      for (int i=0;i<loc.rnas.Count();i++) {
        GffObj& t=*(loc.rnas[i]);
        GStr gname(t.getGeneName());
        if (!gname.is_empty()) {
           gname.upper();
           int* prevg=gnames.Find(gname.chars());
           if (prevg!=NULL) (*prevg)++;
                  else gnames.Add(gname, new int(1));
           }
        //parse GeneID xrefs, if any:
        GStr xrefs(t.getAttr("xrefs"));
        if (!xrefs.is_empty()) {
          xrefs.startTokenize(",");
          GStr token;
          while (xrefs.nextToken(token)) {
            token.upper();
            if (token.startsWith("GENEID:")) {
              token.cut(0,token.index(':')+1);
              int* prevg=geneids.Find(token.chars());
              if (prevg!=NULL) (*prevg)++;
                     else geneids.Add(token, new int(1));
              }
            } //for each xref
          } //xrefs parsing
        }//for each transcript
      locus_num++;
      loc.locus_num=locus_num;
      if (gnames.Count()>0) { //collect all gene names associated to this locus
         gnames.startIterate();
         int* gfreq=NULL;
         char* key=NULL;
         while ((gfreq=gnames.NextData(key))!=NULL) {
            loc.gene_names.AddIfNew(new CGeneSym(key,*gfreq));
            }
         } //added collected gene_names
      if (loc.gene_ids.Count()>0) { //collect all GeneIDs names associated to this locus
         geneids.startIterate();
         int* gfreq=NULL;
         char* key=NULL;
         while ((gfreq=geneids.NextData(key))!=NULL) {
           loc.gene_ids.AddIfNew(new CGeneSym(key,*gfreq));
            }
          }
      } //for each locus
  }//for each genomic sequence
}
Пример #9
0
/*
 * makefile --
 *   Make a unique file from an integer 'n'.
 */
FILE *makefile(int n)
{
     char name[NAMESIZE];
     FILE *fp;
     
     gname(n, name, NAMESIZE);
     fp = fopen(name, "w+");
     if (fp == NULL)
          perror(name);
     return fp;
}
Пример #10
0
/*
 * gremove --
 *   Remove a group of files low...lim.
 */
void gremove(FILE *infile[], int low, int lim)
{
     char name[NAMESIZE];
     int i;

     for (i = 0; i < lim-low+1; i++) {
          if (infile[i] != NULL)
               fclose(infile[i]);
          gname(low+i, name, NAMESIZE);
          remove(name);
     }
}
Пример #11
0
void RunnerDB::getAllNames(vector<string> &givenName, vector<string> &familyName)
{
  givenName.reserve(rdb.size());
  familyName.reserve(rdb.size());
  for (size_t k=0;k<rdb.size(); k++) {
    string gname(rdb[k].getGivenName());
    string fname(rdb[k].getFamilyName());
    if (!gname.empty())
      givenName.push_back(gname);
    if (!fname.empty())
      familyName.push_back(fname);
  }
}
// ============================================================================
// pxpByteCode
// ============================================================================
pxpByteCode::pxpByteCode( pkgDecompiler* decompiler )
:   Decompiler(decompiler)
,   CToken(NULL)
,   CTokenTree(NULL)
,   CTokenGroup(NULL)
,   CTokenGroupTree(NULL)
,   CTokenItem(NULL)
,   CTokenItemTree(NULL)
,   CTokenGroupCnd(NULL)
,   CTokenGroupCndTree(NULL)
,   unXmlParser()
{
    // temp tree nodes
    unXmlParseTree bytecode   ( wxT("bytecode") );
    unXmlParseTree bgroup     ( wxT("group") );
    unXmlParseTree gname      ( wxT("name") );
    unXmlParseTree gmemo      ( wxT("memo") );

    unXmlParseTree gtoken     ( wxT("token") );
    unXmlParseTree tcode      ( wxT("code") );
    unXmlParseTree tname      ( wxT("name") );
    unXmlParseTree tdesc      ( wxT("desc") );
    unXmlParseTree tdata      ( wxT("data") );

    unXmlParseTree titem      ( wxT("item") );
    unXmlParseTree itype      ( wxT("type") );
    unXmlParseTree iname      ( wxT("name") );

    unXmlParseTree ttext      ( wxT("text") );

    unXmlParseTree gcond      ( wxT("gcond") );
    unXmlParseTree cif        ( wxT("if") );
    unXmlParseTree ceq        ( wxT("eq") );
    unXmlParseTree cthen      ( wxT("then") );
    unXmlParseTree cleft      ( wxT("left") );
    unXmlParseTree cright     ( wxT("right") );

    unXmlParseTree ctstream   ( wxT("tstream") );
    unXmlParseTree cnum       ( wxT("num") );

    unXmlParseTree nfunc      ( wxT("nativefunctions") );
    unXmlParseTree ffirst     ( wxT("first") );
    unXmlParseTree fextended  ( wxT("extended") );

    // token group - pre
    bgroup.AddCommand( new_xpObjCreate<pkgTokenGroup>(txpParseTree) );
    bgroup.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenGroup, txpTokenGroupObject ) );
    bgroup.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenGroupTree, txpParseTree ) );
        gname.AddCommand( new_xpFunc1( txpTokenGroup, &pkgTokenGroup::SetName, txpNodeName(txpParseTree) ) );
        gname.AddPostCommand( new_xpFunc1( Decompiler, &pkgDecompiler::AddTokenGroup, txpTokenGroup ) );

    // token group - post
    bgroup.AddPostCommand( new_xpObjClear(txpParseTree) );
    bgroup.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenGroup ) );
    bgroup.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenGroupTree ) );

    // gcond = pre
    gcond.AddCommand( new_xpObjCreate<pkgTokenCondition>(txpParseTree) );
    gcond.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenGroupCnd, txpTokenGroupCndObject ) );
    gcond.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenGroupCndTree, txpParseTree ) );

    // gcond = post
    gcond.AddPostCommand( new_xpObjClear(txpParseTree) );
    gcond.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenGroupCnd ) );
    gcond.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenGroupCndTree ) );

    // token - pre
    gtoken.AddCommand( new_xpObjCreate<dtToken>(txpParseTree) );
    gtoken.AddCommand( new_xpFunc1( this, &pxpByteCode::SetToken, txpTokenObject ) );
    gtoken.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenTree, txpParseTree ) );
        tcode.AddCommand( new_xpFunc1( txpTokenTreeObject, &dtToken::SetTokenData, txpNodeData(txpParseTree) ) );
        tname.AddCommand( new_xpFunc1( txpTokenTreeObject, &dtToken::SetTokenName, txpNodeName(txpParseTree) ) );
        tdesc.AddCommand( new_xpFunc1( txpTokenTreeObject, &dtToken::SetDesc, txpNodeName(txpParseTree) ) );
        tdesc.AddCommand( new_xpFunc1( txpTokenGroup, &pkgTokenGroup::AddToken, txpToken ) );
        tdesc.AddCommand( new_xpFunc2( Decompiler, &pkgDecompiler::AddToken, txpToken, txpTokenGroupCnd ) );

    // token - post
    gtoken.AddPostCommand( new_xpFunc0( txpToken, &dtToken::DumpInfo ) );
    gtoken.AddPostCommand( new_xpObjClear(txpParseTree) );
    gtoken.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearToken ) );
    gtoken.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenTree ) );

    // titem - pre
    titem.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenItemTree, txpParseTree ) );
        itype.AddCommand( new_xpObjFactory( txpTokenItemTree, &GDataTypeFactory, &pkgDataTypeFactory::Create, txpNodeName(txpParseTree) ) );
        itype.AddCommand( new_xpFunc1( this, &pxpByteCode::SetTokenItem, txpTokenItemTreeObject ) );
        iname.AddCommand( new_xpFunc1( txpTokenItem, &pkgDataType::SetDesc, txpNodeName(txpParseTree) ) );

    // titem - post
    titem.AddPostCommand( new_xpFunc1( txpToken, &dtToken::AddItem, txpTokenItem ) );
    titem.AddPostCommand( new_xpObjClear(txpParseTree) );
    titem.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenItem ) );
    titem.AddPostCommand( new_xpFunc0( this, &pxpByteCode::ClearTokenItemTree ) );
    
    ffirst.AddCommand( new_xpFunc1( Decompiler, &pkgDecompiler::SetFunctionIdFirst, txpNodeData(txpParseTree) ) );
    fextended.AddCommand( new_xpFunc1( Decompiler, &pkgDecompiler::SetFunctionIdExtended, txpNodeData(txpParseTree) ) );


    // construct tree starting from leaves
    // ie: node on right side *cannot* appear anywhere below on left side

    // token
    gtoken.AddChild( tcode, pl::one );
    gtoken.AddChild( tname, pl::one );
    gtoken.AddChild( tdesc, pl::one );
            titem.AddChild( itype, pl::one );
            titem.AddChild( iname, pl::one );
        tdata.AddChild( titem, pl::minone );
        tdata.AddChild( ttext, pl::maxone );
    gtoken.AddChild( tdata, pl::maxone );

    // if
            cleft.AddChild( ctstream, pl::maxone );
            cleft.AddChild( cnum, pl::maxone );
            cright.AddChild( ctstream, pl::maxone );
            cright.AddChild( cnum, pl::maxone );
        ceq.AddChild( cleft, pl::one );
        ceq.AddChild( cright, pl::one );
    cif.AddChild( ceq, pl::one );

    // then
    cthen.AddChild( gtoken, pl::any );

    // group
    bgroup.AddChild( gname, pl::one );
    bgroup.AddChild( gmemo, pl::any );
        gcond.AddChild( cif, pl::one );
        gcond.AddChild( cthen, pl::one );
    bgroup.AddChild( gcond, pl::maxone );
    bgroup.AddChild( gtoken, pl::any );

    // native functions
    nfunc.AddChild( fextended, pl::one );
    nfunc.AddChild( ffirst, pl::one );

    // bytecode
    bytecode.AddChild( bgroup, pl::minone );
    bytecode.AddChild( nfunc, pl::maxone );

    ParseTree = new unXmlParseTree( bytecode );
}
Пример #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();
}
Пример #14
0
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();
}