bool CWsPackageProcessEx::onAddPackage(IEspContext &context, IEspAddPackageRequest &req, IEspAddPackageResponse &resp) { resp.updateStatus().setCode(0); StringAttr target(req.getTarget()); StringAttr name(req.getPackageMap()); if (target.isEmpty()) throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "Target cluster parameter required"); if (name.isEmpty()) throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "PackageMap name parameter required"); DBGLOG("%s adding packagemap %s to target %s", context.queryUserId(), name.str(), target.str()); StringBuffer pmid; if (!req.getGlobalScope()) pmid.append(target).append("::"); pmid.append(name.get()); bool activate = req.getActivate(); unsigned updateFlags = 0; if (req.getOverWrite()) updateFlags |= (DALI_UPDATEF_PACKAGEMAP | DALI_UPDATEF_REPLACE_FILE | DALI_UPDATEF_CLONE_FROM | DALI_UPDATEF_SUPERFILES); if (req.getReplacePackageMap()) updateFlags |= DALI_UPDATEF_PACKAGEMAP; if (req.getUpdateCloneFrom()) updateFlags |= DALI_UPDATEF_CLONE_FROM; if (req.getUpdateSuperFiles()) updateFlags |= DALI_UPDATEF_SUPERFILES; if (req.getAppendCluster()) updateFlags |= DALI_UPDATEF_APPEND_CLUSTER; StringAttr processName(req.getProcess()); Owned<IUserDescriptor> userdesc; const char *user = context.queryUserId(); const char *password = context.queryPassword(); if (user && *user && *password && *password) { userdesc.setown(createUserDescriptor()); userdesc->set(user, password); } StringBuffer srcCluster; StringBuffer daliip; StringBuffer prefix; splitDerivedDfsLocation(req.getDaliIp(), srcCluster, daliip, prefix, req.getSourceProcess(), req.getSourceProcess(), NULL, NULL); StringBuffer pkgSetId; buildPkgSetId(pkgSetId, processName.get()); StringArray filesNotFound; addPackageMapInfo(updateFlags, req.getInfo(), filesNotFound, processName, target, pmid, pkgSetId, daliip, srcCluster, prefix, activate, userdesc, req.getAllowForeignFiles(), req.getPreloadAllPackages()); resp.setFilesNotFound(filesNotFound); StringBuffer msg; msg.append("Successfully loaded ").append(name.get()); resp.updateStatus().setDescription(msg.str()); return true; }
void setDerivedDfsLocation(const char *dfsLocation, const char *srcProcess) { splitDerivedDfsLocation(dfsLocation, srcCluster, daliIP, prefix, srcProcess, srcProcess, NULL, NULL); if (srcCluster.length()) { if (!isProcessCluster(daliIP, srcCluster)) throw MakeStringException(PKG_INVALID_CLUSTER_TYPE, "Process cluster %s not found on %s DALI", srcCluster.str(), daliIP.length() ? daliIP.str() : "local"); } }
bool CWsPackageProcessEx::onAddPackage(IEspContext &context, IEspAddPackageRequest &req, IEspAddPackageResponse &resp) { resp.updateStatus().setCode(0); StringAttr target(req.getTarget()); StringAttr name(req.getPackageMap()); if (target.isEmpty()) throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "Target cluster parameter required"); if (name.isEmpty()) throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "PackageMap name parameter required"); StringBuffer pmid; if (!req.getGlobalScope()) pmid.append(target).append("::"); pmid.append(name.get()); bool activate = req.getActivate(); bool overWrite = req.getOverWrite(); StringAttr processName(req.getProcess()); Owned<IUserDescriptor> userdesc; const char *user = context.queryUserId(); const char *password = context.queryPassword(); if (user && *user && *password && *password) { userdesc.setown(createUserDescriptor()); userdesc->set(user, password); } StringBuffer srcCluster; StringBuffer daliip; StringBuffer prefix; splitDerivedDfsLocation(req.getDaliIp(), srcCluster, daliip, prefix, req.getSourceProcess(), req.getSourceProcess(), NULL, NULL); StringBuffer pkgSetId; buildPkgSetId(pkgSetId, processName.get()); StringArray filesNotFound; addPackageMapInfo(req.getInfo(), filesNotFound, processName, target, pmid, pkgSetId, daliip, srcCluster, prefix, activate, overWrite, userdesc, req.getAllowForeignFiles(), req.getPreloadAllPackages()); resp.setFilesNotFound(filesNotFound); StringBuffer msg; msg.append("Successfully loaded ").append(name.get()); resp.updateStatus().setDescription(msg.str()); return true; }