void NsAdapterCatalog::addReplica(const Replica& replica) throw (DmException) { struct dpns_fileid uniqueId; // If server is empty, parse the surl std::string host; if (replica.server.empty()) { Url u(replica.rfn); host = u.domain; if (host.empty()) throw DmException(DM_INVALID_VALUE, "Empty server specified, and SFN does not include it: %s", replica.rfn.c_str()); } else { host = replica.server; } uniqueId.fileid = replica.fileid; strncpy(uniqueId.server, getenv("DPNS_HOST"), sizeof(uniqueId.server)); std::string pool; if (replica.hasField("pool")) pool = replica.getString("pool"); std::string filesystem; if (replica.hasField("filesystem")) filesystem = replica.getString("filesystem"); wrapCall(dpns_addreplica(NULL, &uniqueId, host.c_str(), replica.rfn.c_str(), replica.status, replica.type, pool.c_str(), filesystem.c_str())); }