virtual int processCMD() { Owned<IClientWsPackageProcess> packageProcessClient = createCmdClient(WsPackageProcess, *this); StringBuffer pkgInfo; pkgInfo.loadFile(optFileName); fprintf(stdout, "\n ... adding package map %s now\n\n", optFileName.sget()); Owned<IClientAddPackageRequest> request = packageProcessClient->createAddPackageRequest(); request->setActivate(optActivate); request->setInfo(pkgInfo); request->setTarget(optTarget); request->setPackageMap(optPackageMapId); request->setProcess(optProcess); request->setDaliIp(optDaliIP); request->setOverWrite(optOverWrite); request->setGlobalScope(optGlobalScope); request->setSourceProcess(optSourceProcess); Owned<IClientAddPackageResponse> resp = packageProcessClient->AddPackage(request); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); StringArray ¬Found = resp->getFilesNotFound(); if (notFound.length()) { fputs("\nFiles defined in package but not found in DFS:\n", stderr); ForEachItemIn(i, notFound) fprintf(stderr, " %s\n", notFound.item(i)); fputs("\n", stderr); } return 0; }
bool finalizeOptions(IProperties *globals) { if (optInput.length()) { const char *in = optInput.get(); while (*in && isspace(*in)) in++; if (*in!='<') { StringBuffer content; content.loadFile(in); optInput.set(content.str()); } } if (optESDLDefID.isEmpty()) throw MakeStringException( 0, "ESDL definition ID must be provided!" ); if (optESDLService.isEmpty()) throw MakeStringException( 0, "ESDL service definition name must be provided!" ); if(optTargetESPProcName.isEmpty()) throw MakeStringException( 0, "Name of Target ESP process must be provided!" ); if (optPortOrName.isEmpty()) throw MakeStringException( 0, "Either the target ESP service port of name must be provided!" ); else { const char * portorname = optPortOrName.get(); isdigit(*portorname) ? optTargetPort.set(portorname) : optService.set(portorname); } return EsdlPublishCmdCommon::finalizeOptions(globals); }
static bool loadFile(StringBuffer& s, const char* file) { try { s.loadFile(file); } catch (IException* e) { StringBuffer msg; fprintf(stderr,"Exception caught: %s", e->errorMessage(msg).str()); return false; } return true; }
bool finalizeOptions(IProperties *globals) { if (optInput.length()) { const char *in = optInput.get(); while (*in && isspace(*in)) in++; if (*in!='<') { StringBuffer content; content.loadFile(in); optInput.set(content.str()); } } if (!optVersionStr.isEmpty()) { optVersion = atof( optVersionStr.get() ); if( optVersion <= 0 ) { throw MakeStringException( 0, "Version option must be followed by a real number > 0" ); } } else throw MakeStringException( 0, "ESDL service definition version must be provided!" ); if(optTargetESPProcName.isEmpty()) throw MakeStringException( 0, "Name of Target ESP process must be provided" ); if (optService.isEmpty()) throw MakeStringException( 0, "Name of ESDL based service must be provided" ); if (optWSProcAddress.isEmpty()) throw MakeStringException( 0, "Server address of ESDL process server must be provided" ); if (optWSProcPort.isEmpty()) throw MakeStringException( 0, "Port on which ESDL process is listening must be provided" ); if (optMethod.isEmpty()) throw MakeStringException( 0, "Name of ESDL based method must be provided" ); if (optBindingName.isEmpty()) throw MakeStringException( 0, "Name of ESP binding must be provided" ); return true; }
int CLibXmlValidator::setXmlSource(const char* filename) { if (!filename) return 0; try { xml.loadFile(filename); } catch (IException* e) { DBGLOG(e); e->Release(); return 0; } xmlFile.set(filename); return 1; }
int HttpClient::sendRequest(const char* infile) { StringBuffer req; if(infile && *infile) { try { req.loadFile(infile, true); } catch(IException* e) { StringBuffer errmsg; printf("\nerror loading file %s - %s", infile, e->errorMessage(errmsg).str()); return -1; } catch(...) { printf("\nerror loading file %s", infile); return -1; } } if(req.length() == 0) { if(httptest_tracelevel > 0) printf("using default request\n"); req.append("GET / HTTP/1.0\r\n"); req.append("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*\r\n"); req.append("Accept-Language: en-us\r\n"); //req.append("Accept-Encoding: gzip, deflate\r\n"); req.append("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"); req.append("Host: ").append(m_host.str()); if(m_port != 80) req.appendf(":%d", m_port); req.append("\r\n"); req.append("\r\n"); } return sendRequest(req); }
virtual int processCMD() { Owned<IClientWsPackageProcess> packageProcessClient = getWsPackageSoapService(optServer, optPort, optUsername, optPassword); StringBuffer pkgInfo; pkgInfo.loadFile(optFileName); fprintf(stdout, "\n ... adding package %s now\n\n", optFileName.sget()); Owned<IClientAddPackageRequest> request = packageProcessClient->createAddPackageRequest(); request->setActivate(optActivate); request->setInfo(pkgInfo); request->setQuerySet(optQuerySet); request->setPackageName(optFileName); request->setOverWrite(optOverWrite); Owned<IClientAddPackageResponse> resp = packageProcessClient->AddPackage(request); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); return 0; }
bool finalizeOptions(IProperties *globals) { if (optInput.length()) { const char *in = optInput.get(); while (*in && isspace(*in)) in++; if (*in!='<') { StringBuffer content; content.loadFile(in); optInput.set(content.str()); } } if (optESDLDefID.isEmpty()) throw MakeStringException( 0, "ESDL definition ID must be provided!" ); if (optESDLService.isEmpty()) throw MakeStringException( 0, "ESDL service definition name must be provided!" ); if(optTargetESPProcName.isEmpty()) throw MakeStringException( 0, "Name of Target ESP process must be provided!" ); if (optPortOrName.isEmpty()) throw MakeStringException( 0, "Either the target ESP service port of name must be provided!" ); else { const char * portorname = optPortOrName.get(); isdigit(*portorname) ? optTargetPort.set(portorname) : optService.set(portorname); } if (optWSProcAddress.isEmpty()) throw MakeStringException( 0, "Server address of ESDL process server must be provided" ); if (optWSProcPort.isEmpty()) throw MakeStringException( 0, "Port on which ESDL process is listening must be provided" ); return true; }
virtual int processCMD() { Owned<IClientWsPackageProcess> packageProcessClient = getWsPackageSoapService(optServer, optPort, optUsername, optPassword); StringBuffer pkgInfo; pkgInfo.loadFile(optFileName); fprintf(stdout, "\n ... looking up files in package to see what needs copying\n\n"); Owned<IClientCopyFilesRequest> request = packageProcessClient->createCopyFilesRequest(); request->setInfo(pkgInfo); request->setProcess(optProcess); request->setPackageName(optFileName); request->setOverWrite(optOverWrite); if (!optDaliIp.isEmpty()) request->setDaliIp(optDaliIp.get()); Owned<IClientCopyFilesResponse> resp = packageProcessClient->CopyFiles(request); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); return 0; }
void CEnvGen::addUpdateTaskFromFile(const char * inFile) { Owned<IPropertyTree> inPTree; if ((String(inFile).toLowerCase())->endsWith(".json")) { StringBuffer sbFile; sbFile.loadFile(inFile); inPTree.setown(createPTreeFromJSONString(sbFile.str())); } else { inPTree.setown(createPTreeFromXMLFile(inFile)); } // add Config attributies to params IPropertyTree *pCfg = m_params->queryPropTree("Config"); assert(pCfg); Owned<IAttributeIterator> attrIter = inPTree->getAttributes(); ForEach(*attrIter) { const char* propName = attrIter->queryName(); if (!(*propName)) continue; pCfg->setProp(propName, attrIter->queryValue()); } // add Tasks to params Owned<IPropertyTreeIterator> taskIter = inPTree->getElements("Task"); ForEach(*taskIter) { IPropertyTree* task = &taskIter->query(); StringBuffer sb; toXML(task, sb); pCfg->addPropTree("Task", createPTreeFromXMLString(sb.str())); } }
virtual int processCMD() { Owned<IClientWsPackageProcess> packageProcessClient = createCmdClient(WsPackageProcess, *this); StringBuffer pkgInfo; pkgInfo.loadFile(optFileName); fprintf(stdout, "\n ... adding package map %s now\n\n", optFileName.sget()); Owned<IClientAddPackageRequest> request = packageProcessClient->createAddPackageRequest(); request->setActivate(optActivate); request->setInfo(pkgInfo); request->setTarget(optTarget); request->setPackageMap(optPackageMapId); request->setProcess(optProcess); request->setDaliIp(optDaliIP); request->setOverWrite(optOverWrite); Owned<IClientAddPackageResponse> resp = packageProcessClient->AddPackage(request); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); return 0; }
int main(int argc, char** argv) { InitModuleObjects(); const char* out_envname = NULL; const char* in_ipfilename; StringBuffer ipAddrs; int roxieNodes=0, thorNodes=0, slavesPerNode=1; MapStringTo<StringBuffer> dirMap; int i = 1; bool writeToFiles = false; int port = 80; while(i<argc) { if(stricmp(argv[i], "-help") == 0 || stricmp(argv[i], "-?") == 0) { usage(); releaseAtoms(); return 0; } else if (stricmp(argv[i], "-env") == 0) { i++; out_envname = argv[i++]; } else if (stricmp(argv[i], "-roxienodes") == 0) { i++; roxieNodes = atoi(argv[i++]); } else if (stricmp(argv[i], "-thornodes") == 0) { i++; thorNodes = atoi(argv[i++]); } else if (stricmp(argv[i], "-slavespernode") == 0) { i++; slavesPerNode = atoi(argv[i++]); } else if (stricmp(argv[i], "-ip") == 0) { i++; ipAddrs.append(argv[i++]); } else if(stricmp(argv[i], "-ipfile") == 0) { i++; in_ipfilename = argv[i++]; ipAddrs.loadFile(in_ipfilename); } else if(stricmp(argv[i], "-o") == 0) { i++; StringArray sbarr; DelimToStringArray(argv[i++], sbarr, "="); if (sbarr.length() != 2) continue; if (strstr(sbarr.item(1), "[NAME]") && (strstr(sbarr.item(1), "[INST]") || strstr(sbarr.item(1), "[COMPONENT]"))) dirMap.setValue(sbarr.item(0), sbarr.item(1)); else { fprintf(stderr, "Error: Directory Override must contain [NAME] and either [INST] or [COMPONENT]\n"); releaseAtoms(); return 1; } } else { fprintf(stderr, "Error: unknown command line parameter: %s\n", argv[i]); usage(); releaseAtoms(); return 1; } } if (!out_envname) { fprintf(stderr, "Error: Output environment xml file is required. Please specify.\n"); usage(); releaseAtoms(); return 1; } if (ipAddrs.length() == 0) { fprintf(stderr, "Error: Ip addresses are required. Please specify.\n"); usage(); releaseAtoms(); return 1; } try { validateIPS(ipAddrs.str()); StringBuffer optionsXml, envXml; const char* pServiceName = "WsDeploy_wsdeploy_esp"; Owned<IPropertyTree> pCfg = createPTreeFromXMLFile(ENVGEN_PATH_TO_ESP_CONFIG); optionsXml.appendf("<XmlArgs roxieNodes=\"%d\" thorNodes=\"%d\" slavesPerNode=\"%d\" ipList=\"%s\"/>", roxieNodes, thorNodes, slavesPerNode, ipAddrs.str()); buildEnvFromWizard(optionsXml, pServiceName, pCfg, envXml, &dirMap); if(envXml.length()) { StringBuffer env; StringBuffer thisip; queryHostIP().getIpText(thisip); env.appendf("<"XML_HEADER">\n<!-- Generated with envgen on ip %s -->\n", thisip.str()); env.append(envXml); Owned<IEnvironmentFactory> factory = getEnvironmentFactory(); Owned<IConstEnvironment> constEnv = factory->loadLocalEnvironment(env); validateEnv(constEnv); Owned<IFile> pFile; pFile.setown(createIFile(out_envname)); Owned<IFileIO> pFileIO; pFileIO.setown(pFile->open(IFOcreaterw)); pFileIO->write(0, env.length(), env.str()); } } catch(IException *excpt) { StringBuffer errMsg; fprintf(stderr, "Exception: %d:\n%s\n", excpt->errorCode(), excpt->errorMessage(errMsg).str()); releaseAtoms(); excpt->Release(); return 1; } catch(...) { fprintf(stderr, "Unknown exception\n"); releaseAtoms(); return 1; } releaseAtoms(); return 0; }
int CDfuPlusHelper::add() { const char* lfn = globals->queryProp("dstname"); if(lfn == NULL || *lfn == '\0') throw MakeStringException(-1, "dstname not specified"); bool isRemote = false; const char* xmlfname = globals->queryProp("srcxml"); const char* srcname = globals->queryProp("srcname"); const char* srcdali = globals->queryProp("srcdali"); const char* srcusername = globals->queryProp("srcusername"); const char* srcpassword = globals->queryProp("srcpassword"); if(xmlfname == NULL || *xmlfname == '\0') { if(srcname == NULL || *srcname == '\0') throw MakeStringException(-1, "Please specify srcxml for adding from xml, or srcname for adding from remote dali"); else { isRemote = true; if(srcdali == NULL || *srcdali == '\0') throw MakeStringException(-1, "srcdali not specified for adding remote"); } } if(!isRemote) { MemoryBuffer xmlbuf; StringBuffer buf; buf.loadFile(xmlfname); int len = buf.length(); xmlbuf.setBuffer(len, buf.detach(), true); Owned<IClientAddRequest> req = dfuclient->createAddRequest(); req->setDstname(lfn); req->setXmlmap(xmlbuf); Owned<IClientAddResponse> resp = dfuclient->Add(req); const IMultiException* excep = &resp->getExceptions(); if(excep != NULL && excep->ordinality() > 0) { StringBuffer errmsg; excep->errorMessage(errmsg); error("%s\n", errmsg.str()); return -1; } } else { Owned<IClientAddRemoteRequest> req = dfuclient->createAddRemoteRequest(); req->setDstname(lfn); req->setSrcname(srcname); req->setSrcdali(srcdali); if(srcusername != NULL) req->setSrcusername(srcusername); if(srcpassword != NULL) req->setSrcpassword(srcpassword); Owned<IClientAddRemoteResponse> resp = dfuclient->AddRemote(req); const IMultiException* excep = &resp->getExceptions(); if(excep != NULL && excep->ordinality() > 0) { StringBuffer errmsg; excep->errorMessage(errmsg); error("%s\n", errmsg.str()); return -1; } } info("%s successfully added", lfn); return 0; }
virtual int processCMD() { Owned<IClientWsPackageProcess> packageProcessClient = getWsPackageSoapService(optServer, optPort, optUsername, optPassword); Owned<IClientValidatePackageRequest> request = packageProcessClient->createValidatePackageRequest(); if (optFileName.length()) { StringBuffer pkgInfo; pkgInfo.loadFile(optFileName); fprintf(stdout, "\nvalidating packagemap file %s\n\n", optFileName.sget()); request->setInfo(pkgInfo); } request->setActive(optValidateActive); request->setPMID(optPMID); request->setTarget(optTarget); request->setQueryIdToVerify(optQueryId); request->setCheckDFS(optCheckDFS); request->setGlobalScope(optGlobalScope); bool validateMessages = false; Owned<IClientValidatePackageResponse> resp = packageProcessClient->ValidatePackage(request); if (resp->getExceptions().ordinality()>0) { validateMessages = true; outputMultiExceptions(resp->getExceptions()); } StringArray &errors = resp->getErrors(); if (errors.ordinality()>0) { validateMessages = true; fputs(" Error(s):\n", stderr); ForEachItemIn(i, errors) fprintf(stderr, " %s\n", errors.item(i)); } StringArray &warnings = resp->getWarnings(); if (warnings.ordinality()>0) { validateMessages = true; fputs(" Warning(s):\n", stderr); ForEachItemIn(i, warnings) fprintf(stderr, " %s\n", warnings.item(i)); } StringArray &unmatchedQueries = resp->getQueries().getUnmatched(); if (unmatchedQueries.ordinality()>0) { validateMessages = true; fputs("\n Queries without matching package:\n", stderr); ForEachItemIn(i, unmatchedQueries) fprintf(stderr, " %s\n", unmatchedQueries.item(i)); } StringArray &unusedPackages = resp->getPackages().getUnmatched(); if (unusedPackages.ordinality()>0) { validateMessages = true; fputs("\n Packages without matching queries:\n", stderr); ForEachItemIn(i, unusedPackages) fprintf(stderr, " %s\n", unusedPackages.item(i)); } StringArray &unusedFiles = resp->getFiles().getUnmatched(); if (unusedFiles.ordinality()>0) { fputs("\n Files without matching package definitions:\n", stderr); ForEachItemIn(i, unusedFiles) fprintf(stderr, " %s\n", unusedFiles.item(i)); } StringArray ¬InDFS = resp->getFiles().getNotInDFS(); if (notInDFS.ordinality()>0) { fputs("\n Packagemap SubFiles not found in DFS:\n", stderr); ForEachItemIn(i, notInDFS) fprintf(stderr, " %s\n", notInDFS.item(i)); } if (!validateMessages) fputs(" Validation was successful\n", stdout); return 0; }
int CDfuPlusHelper::spray() { const char* srcxml = globals->queryProp("srcxml"); const char* srcip = globals->queryProp("srcip"); const char* srcfile = globals->queryProp("srcfile"); bool nowait = globals->getPropBool("nowait", false); MemoryBuffer xmlbuf; if(srcxml == NULL) { if(srcfile == NULL) throw MakeStringException(-1, "srcfile not specified"); if(srcip == NULL) { #ifdef DAFILESRV_LOCAL progress("srcip not specified - assuming spray from local machine\n"); srcip = "."; #else throw MakeStringException(-1, "srcip not specified"); #endif } } else { if(srcip != NULL || srcfile != NULL) throw MakeStringException(-1, "srcip/srcfile and srcxml can't be used at the same time"); StringBuffer buf; buf.loadFile(srcxml); int len = buf.length(); xmlbuf.setBuffer(len, buf.detach(), true); } const char* dstname = globals->queryProp("dstname"); if(dstname == NULL) throw MakeStringException(-1, "dstname not specified"); const char* dstcluster = globals->queryProp("dstcluster"); if(dstcluster == NULL) throw MakeStringException(-1, "dstcluster not specified"); const char* format = globals->queryProp("format"); if(format == NULL) format = "fixed"; SocketEndpoint localep; StringBuffer localeps; if (checkLocalDaFileSvr(srcip,localep)) srcip = localep.getUrlStr(localeps).str(); StringBuffer wuid; StringBuffer errmsg; bool ok; if ((stricmp(format, "fixed") == 0)||(stricmp(format, "recfmvb") == 0)||(stricmp(format, "recfmv") == 0)||(stricmp(format, "variablebigendian") == 0)) ok = fixedSpray(srcxml,srcip,srcfile,xmlbuf,dstcluster,dstname,format,wuid,errmsg); else if((stricmp(format, "csv") == 0) ||(stricmp(format, "xml") == 0)||(stricmp(format, "variable") == 0)) ok = variableSpray(srcxml,srcip,srcfile,xmlbuf,dstcluster,dstname,format,wuid, errmsg); else throw MakeStringException(-1, "format %s not supported", format); if (!ok) { if(errmsg.length()) error("%s\n", errmsg.str()); else throw MakeStringException(-1, "unknown error spraying"); } else { const char* jobname = globals->queryProp("jobname"); if(jobname && *jobname) updatejobname(wuid.str(), jobname); info("Submitted WUID %s\n", wuid.str()); if(!nowait) waitToFinish(wuid.str()); } return 0; }
int HttpClient::sendSoapRequest(const char* url, const char* soapaction, const char* infile) { if(!url || !*url || !infile || !*infile) return 0; StringBuffer protocol, user, passwd, port, path; m_host.clear(); SplitURL(url, protocol, user, passwd, m_host, port, path); if(port.length() > 0) m_port = atoi(port.str()); else { if(protocol.length() > 0 && stricmp(protocol.str(), "https") == 0) m_port = 443; else m_port = 80; } if(stricmp(protocol.str(), "HTTPS") == 0) m_use_ssl = true; if(m_use_ssl) { #ifdef USE_OPENSSL if(m_ssctx.get() == NULL) m_ssctx.setown(createSecureSocketContext(ClientSocket)); #else throw MakeStringException(-1, "HttpClient: failure to create SSL socket - OpenSSL not enabled in build"); #endif } StringBuffer request; try { request.loadFile(infile, true); } catch(IException* e) { StringBuffer errmsg; printf("\nerror loading file %s - %s", infile, e->errorMessage(errmsg).str()); return -1; } catch(...) { printf("\nerror loading file %s", infile); return -1; } if(request.length() == 0) { printf("input is empty\n"); return -1; } const char* ptr = request.str(); while(*ptr == ' ') ptr++; if(*ptr != '<') { printf("the input should be xml\n"); return -1; } if(strncmp(ptr, "<?xml", 5) != 0 && strncmp(ptr, "<soap:Envelope", 14) != 0) { request.insert(0, "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/04/secext\"><soap:Body>"); request.append("</soap:Body></soap:Envelope>"); } StringBuffer headers; headers.appendf("POST %s HTTP/1.1\r\n", path.str()); headers.append("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*\r\n"); headers.append("Accept-Language: en-us\r\n"); headers.append("Content-Type: text/xml\r\n"); if(soapaction && *soapaction) headers.appendf("SOAPAction: \"%s\"\r\n", soapaction); //headers.append("Accept-Encoding: gzip, deflate\r\n"); headers.append("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"); headers.appendf("Content-Length: %d\r\n", request.length()); headers.append("Host: ").append(m_host.str()); if(m_port != 80) headers.appendf(":%d", m_port); headers.append("\r\n"); if(user.length() > 0) { StringBuffer auth, abuf; abuf.appendf("%s:%s", user.str(), passwd.str()); JBASE64_Encode(abuf.str(), abuf.length(), auth); headers.appendf("Authorization: Basic %s\r\n", auth.str()); } headers.append("\r\n"); request.insert(0, headers.str()); return sendRequest(request); }
int CDfuPlusHelper::despray() { const char* srcname = globals->queryProp("srcname"); if(srcname == NULL) throw MakeStringException(-1, "srcname not specified"); const char* dstxml = globals->queryProp("dstxml"); const char* dstip = globals->queryProp("dstip"); const char* dstfile = globals->queryProp("dstfile"); bool nowait = globals->getPropBool("nowait", false); MemoryBuffer xmlbuf; if(dstxml == NULL) { if(dstfile == NULL) throw MakeStringException(-1, "dstfile not specified"); if(dstip == NULL) { #ifdef DAFILESRV_LOCAL progress("dstip not specified - assuming spray from local machine\n"); dstip = "."; #else throw MakeStringException(-1, "dstip not specified"); #endif } } else { if(dstip != NULL || dstfile != NULL) throw MakeStringException(-1, "dstip/dstfile and dstxml can't be used at the same time"); StringBuffer buf; buf.loadFile(dstxml); int len = buf.length(); xmlbuf.setBuffer(len, buf.detach(), true); } if(dstxml == NULL) info("\nDespraying %s to host %s file %s\n", srcname, dstip, dstfile); else info("\nDespraying %s\n", srcname); Owned<IClientDespray> req = sprayclient->createDesprayRequest(); req->setSourceLogicalName(srcname); if(dstxml == NULL) { req->setDestIP(dstip); req->setDestPath(dstfile); } else req->setDstxml(xmlbuf); req->setOverwrite(globals->getPropBool("overwrite", false)); if(globals->hasProp("connect")) req->setMaxConnections(globals->getPropInt("connect")); if(globals->hasProp("throttle")) req->setThrottle(globals->getPropInt("throttle")); if(globals->hasProp("transferbuffersize")) req->setTransferBufferSize(globals->getPropInt("transferbuffersize")); if(globals->hasProp("norecover")) req->setNorecover(globals->getPropBool("norecover", false)); else if(globals->hasProp("noRecover")) req->setNorecover(globals->getPropBool("noRecover", false)); if(globals->hasProp("splitprefix")) req->setSplitprefix(globals->queryProp("splitprefix")); else if(globals->hasProp("splitPrefix")) req->setSplitprefix(globals->queryProp("splitPrefix")); if(globals->hasProp("wrap")) req->setWrap(globals->getPropBool("wrap", false)); if(globals->hasProp("multicopy")) req->setMultiCopy(globals->getPropBool("multicopy", false)); else if(globals->hasProp("multiCopy")) req->setMultiCopy(globals->getPropBool("multiCopy", false)); if(globals->hasProp("compress")) req->setCompress(globals->getPropBool("compress", false)); if(globals->hasProp("encrypt")) req->setEncrypt(globals->queryProp("encrypt")); if(globals->hasProp("decrypt")) req->setDecrypt(globals->queryProp("decrypt")); SocketEndpoint localep; StringBuffer localeps; if (checkLocalDaFileSvr(dstip,localep)) dstip = localep.getUrlStr(localeps).str(); Owned<IClientDesprayResponse> result = sprayclient->Despray(req); const char* wuid = result->getWuid(); if(wuid == NULL || *wuid == '\0') exc(result->getExceptions(),"despraying"); else { const char* jobname = globals->queryProp("jobname"); if(jobname && *jobname) updatejobname(wuid, jobname); info("Submitted WUID %s\n", wuid); if(!nowait) waitToFinish(wuid); } return 0; }
int main( int argc, char *argv[] ) { int res=0; if (argc < 3) { printf("frunagent <nodelist> start \"command\" [options] \n" " stop <commandid> [options]\n" " account <user> <password> <dir> [option]\n" " dir <dir> [option]\n" " alive <integer> [option]\n\n" "where <nodelist> is of the form h009100:h009119,h007010:h007020\n" "or 192.168.6.100:192.168.6.119,192.168.7.10:192.168.7.20\n" "or @filename where filename contains a file in the above format\n" "options: /n<number_of_thread> /t<call_time_out> /encrypt /o<replication_offset>\n" ); return 255; } InitModuleObjects(); StringBuffer tracepath; tracepath.append(".").append(PATHSEPCHAR).append("frunagent.txt"); settrace(tracepath.str(),false); ECHO_TO_CONSOLE=true; try { setoptions(argc,argv); split_node x(argc,argv); if (argv[1][0]=='@') { StringBuffer b; b.loadFile(argv[1]+1); char *finger = (char *) b.str(); while (*finger) { if (*finger == '\n') *finger++ = ';'; else if (*finger == '#') { while (*finger && *finger != '\n') *finger++ = ' '; } else finger++; } x.split_nodes_ex(b.str(),replicationoffset); } else x.split_nodes_ex(argv[1],replicationoffset); disp->all_done_ex(false); } catch(IException *e) { pexception("",e); e->Release(); res=255; } catch (...) { traceft("Caught unknown exception"); } #ifdef _TRACING traceflush(); #endif if (disp) delete disp; return res; }