IClientWsWorkunits * createWorkunitsClient(IProperties * _globals) { Owned<IClientWsWorkunits> wuclient = createWsWorkunitsClient(); const char* eclwatch = _globals->queryProp("server"); if(eclwatch == NULL) throw MakeStringException(0, "Server url not defined"); StringBuffer url; if(Utils::strncasecmp(eclwatch, "http://", 7) != 0 && Utils::strncasecmp(eclwatch, "https://", 8) != 0) url.append("http://"); url.append(eclwatch); if(strchr(url.str() + 7, ':') == NULL) url.append(":8010/"); if(url.charAt(url.length() - 1) != '/') url.append("/"); url.append("WsWorkUnits"); wuclient->addServiceUrl(url.str()); const char* username = _globals->queryProp("user"); if (!username) username = _globals->queryProp("owner"); const char* password = _globals->queryProp("password"); if(username != NULL) wuclient->setUsernameToken(username, password, NULL); return LINK(wuclient.get()); }
virtual int processCMD() { Owned<IClientWsWorkunits> client = createWsWorkunitsClient(); VStringBuffer url("http://%s:%s/WsWorkunits", optServer.sget(), optPort.sget()); client->addServiceUrl(url.str()); if (optUsername.length()) client->setUsernameToken(optUsername.get(), optPassword.sget(), NULL); StringBuffer wuid; if (optObj.type==eclObjWuid) wuid.set(optObj.value.get()); else if (!doDeploy(client, optObj, optCluster.get(), optName.get(), &wuid)) return 1; StringBuffer descr; fprintf(stdout, "\nPublishing %s\n", wuid.str()); Owned<IClientWUPublishWorkunitRequest> req = client->createWUPublishWorkunitRequest(); req->setWuid(wuid.str()); req->setActivate(optActivate); if (optName.length()) req->setJobName(optName.get()); if (optCluster.length()) req->setCluster(optCluster.get()); Owned<IClientWUPublishWorkunitResponse> resp = client->WUPublishWorkunit(req); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); const char *id = resp->getQueryId(); if (id && *id) fprintf(stdout, "\nPublished\nQuerySet: %s\nQueryName: %s\nQueryId: %s\n", resp->getQuerySet(), resp->getQueryName(), resp->getQueryId()); return 0; }
virtual int processCMD() { StringBuffer s; Owned<IClientWsWorkunits> client = createWsWorkunitsClient(); VStringBuffer url("http://%s:%s/WsWorkunits", optServer.sget(), optPort.sget()); client->addServiceUrl(url.str()); if (optUsername.length()) client->setUsernameToken(optUsername.get(), optPassword.sget(), NULL); Owned<IClientWUQuerySetAliasActionRequest> req = client->createWUQuerysetAliasActionRequest(); IArrayOf<IEspQuerySetAliasActionItem> aliases; Owned<IEspQuerySetAliasActionItem> item = createQuerySetAliasActionItem(); item->setName(optAlias.get()); aliases.append(*item.getClear()); req->setAliases(aliases); req->setAction("Deactivate"); req->setQuerySetName(optQuerySet.get()); Owned<IClientWUQuerySetAliasActionResponse> resp = client->WUQuerysetAliasAction(req); IArrayOf<IConstQuerySetAliasActionResult> &results = resp->getResults(); if (resp->getExceptions().ordinality()) outputMultiExceptions(resp->getExceptions()); else if (results.empty()) fprintf(stderr, "\nError Empty Result!\n"); else { IConstQuerySetAliasActionResult &item = results.item(0); if (item.getSuccess()) fprintf(stdout, "Deactivated alias %s/%s\n", optQuerySet.sget(), optAlias.sget()); else if (item.getCode()|| item.getMessage()) fprintf(stderr, "Error (%d) %s\n", item.getCode(), item.getMessage()); } return 0; }
virtual int processCMD() { Owned<IClientWsWorkunits> client = createWsWorkunitsClient(); VStringBuffer url("http://%s:%s/WsWorkunits", optServer.sget(), optPort.sget()); client->addServiceUrl(url.str()); if (optUsername.length()) client->setUsernameToken(optUsername.get(), optPassword.sget(), NULL); return doDeploy(client, optObj, optCluster.get(), optName.get(), NULL) ? 0 : 1; }