ソースを参照

HPCC-8083 Ecl packagemap no longer needs to support copyFiles

Signed-off-by: Stuart Ort <stuart.ort@lexisnexis.com>
Stuart Ort 12 年 前
コミット
838b214772

+ 0 - 110
ecl/ecl-package/ecl-package.cpp

@@ -599,114 +599,6 @@ private:
 };
 
 
-
-class EclCmdPackageCopyFiles : public EclCmdCommon
-{
-public:
-    EclCmdPackageCopyFiles() :optOverWrite (false)
-    {
-    }
-    virtual bool parseCommandLineOptions(ArgvIterator &iter)
-    {
-        if (iter.done())
-        {
-            usage();
-            return false;
-        }
-
-        for (; !iter.done(); iter.next())
-        {
-            const char *arg = iter.query();
-            if (*arg!='-')
-            {
-                if (optFileName.isEmpty())
-                    optFileName.set(arg);
-                else
-                {
-                    fprintf(stderr, "\nargument is already defined %s\n", arg);
-                    return false;
-                }
-                continue;
-            }
-            if (iter.matchOption(optDaliIp, ECLOPT_DALIIP))
-                continue;
-            if (iter.matchFlag(optOverWrite, ECLOPT_OVERWRITE))
-                continue;
-            if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
-                return false;
-        }
-        return true;
-    }
-    virtual bool finalizeOptions(IProperties *globals)
-    {
-        if (!EclCmdCommon::finalizeOptions(globals))
-        {
-            usage();
-            return false;
-        }
-        StringBuffer err;
-        if (optFileName.isEmpty())
-            err.append("\n ... Missing package file name\n\n");
-        else if (optTarget.isEmpty())
-            err.append("\n ... Specify a process name\n\n");
-
-        if (err.length())
-        {
-            fprintf(stdout, "%s", err.str());
-            usage();
-            return false;
-        }
-        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 packagemap to see what needs copying\n\n");
-
-        Owned<IClientCopyFilesRequest> request = packageProcessClient->createCopyFilesRequest();
-        request->setInfo(pkgInfo);
-        request->setTarget(optTarget);
-        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;
-    }
-
-    virtual void usage()
-    {
-        fputs("\nUsage:\n"
-                    "\n"
-                    "The 'copyFiles' command will copy any file listed in the packages contained \n"
-                    "in the packagemap file that are not currently known to the cluster.\n"
-                    "This will NOT load the package information \n"
-                    "\n"
-                    "ecl packagemap copyFiles [options] <target> <filename>\n"
-                    " Options:\n"
-                    "   -O, --overwrite             overwrite existing information\n"
-                    "  --daliip=<daliip>            ip of the source dali to use for file lookups\n"
-                    "   <target>                    name of target to use when adding package information\n"
-                    "   <filename>                  name of file containing package information\n",
-                    stdout);
-
-        EclCmdCommon::usage();
-    }
-private:
-    StringAttr optFileName;
-    StringAttr optTarget;
-    StringAttr optDaliIp;
-    StringBuffer pkgInfo;
-    bool optOverWrite;
-};
-
 IEclCommand *createPackageSubCommand(const char *cmdname)
 {
     if (!cmdname || !*cmdname)
@@ -723,8 +615,6 @@ IEclCommand *createPackageSubCommand(const char *cmdname)
         return new EclCmdPackageInfo();
     if (strieq(cmdname, "list"))
         return new EclCmdPackageList();
-    if (strieq(cmdname, "copyFiles"))
-        return new EclCmdPackageCopyFiles();
     return NULL;
 }
 

+ 0 - 16
esp/scm/ws_packageprocess.ecm

@@ -103,21 +103,6 @@ ESPresponse [exceptions_inline] ListPackageResponse
     ESParray<ESPstruct PackageListMapData> PkgListMapData;
 };
 
-ESPrequest CopyFilesRequest
-{
-    string Target;
-    string PackageName;
-    string DaliIp;
-    string Info;
-    bool OverWrite;
-};
-
-
-ESPresponse [exceptions_inline] CopyFilesResponse
-{
-    ESPstruct BasePackageStatus status;
-};
-
 ESPservice [version("1.00"), default_client_version("1.00"), exceptions_inline("./smc_xslt/exceptions.xslt")] WsPackageProcess
 {
     ESPmethod Echo(EchoRequest, EchoResponse);
@@ -127,7 +112,6 @@ ESPservice [version("1.00"), default_client_version("1.00"), exceptions_inline("
     ESPmethod DeActivatePackage(DeActivatePackageRequest, DeActivatePackageResponse);
     ESPmethod ListPackage(ListPackageRequest, ListPackageResponse);
     ESPmethod GetPackage(GetPackageRequest, GetPackageResponse);
-    ESPmethod CopyFiles(CopyFilesRequest, CopyFilesResponse);
 };
 
 SCMexportdef(WsPackageProcess);

+ 0 - 126
esp/services/ws_packageprocess/ws_packageprocessService.cpp

@@ -167,65 +167,6 @@ bool cloneFileInfoToDali(StringArray &fileNames, const char *lookupDaliIp, const
     return cloneFileInfoToDali(fileNames, lookupDaliIp, clusterInfo, overWrite, userdesc);
 }
 
-bool addFileInfoToDali(const char *logicalname, const char *lookupDaliIp, const char *target, bool overwrite, IUserDescriptor* userdesc, StringBuffer &host, short port, StringBuffer &msg)
-{
-    bool retval = true;
-    try
-    {
-        if (!overwrite)
-        {
-            if (isFileKnownOnCluster(logicalname, lookupDaliIp, target, userdesc))
-                return true;
-        }
-
-        StringBuffer user;
-        StringBuffer password;
-
-        if (userdesc)
-        {
-            userdesc->getUserName(user);
-            userdesc->getPassword(password);
-        }
-
-        Owned<IClientFileSpray> fs;
-        fs.setown(createFileSprayClient());
-        fs->setUsernameToken(user.str(), password.str(), NULL);
-
-        VStringBuffer url("http://%s:%d/FileSpray", host.str(), port);
-        fs->addServiceUrl(url.str());
-
-        bool isRoxie = isRoxieProcess(target);
-
-        Owned<IClientCopy> req = fs->createCopyRequest();
-        req->setSourceLogicalName(logicalname);
-        req->setDestLogicalName(logicalname);
-        req->setDestGroup(target);
-        req->setSuperCopy(false);
-        if (isRoxie)
-            req->setDestGroupRoxie("Yes");
-
-        req->setSourceDali(lookupDaliIp);
-
-        req->setSrcusername(user);
-        req->setSrcpassword(password);
-        req->setOverwrite(overwrite);
-
-        Owned<IClientCopyResponse> resp = fs->Copy(req);
-    }
-    catch(IException *e)
-    {
-        e->errorMessage(msg);
-        DBGLOG("ERROR = %s", msg.str());
-        e->Release();  // report the error later if needed
-        retval = false;
-    }
-    catch(...)
-    {
-        retval = false;
-    }
-
-    return retval;
-}
 
 void makePackageActive(IPropertyTree *pkgSetRegistry, IPropertyTree *pkgSetTree, const char *setName)
 {
@@ -324,40 +265,6 @@ void addPackageMapInfo(IPropertyTree *pkgSetRegistry, const char *target, const
         pkgSetTree->setPropBool("@active", false);
 }
 
-void copyPackageSubFiles(IPropertyTree *packageInfo, const char *target, const char *defaultLookupDaliIp, bool overwrite, IUserDescriptor* userdesc, StringBuffer &host, short port)
-{
-    Owned<IPropertyTreeIterator> iter = packageInfo->getElements("Package");
-    ForEach(*iter)
-    {
-        IPropertyTree &item = iter->query();
-        StringBuffer lookupDaliIp;
-        lookupDaliIp.append(item.queryProp("@daliip"));
-        if (lookupDaliIp.length() == 0)
-            lookupDaliIp.append(defaultLookupDaliIp);
-        if (lookupDaliIp.length() == 0)
-        {
-            StringAttr superfile(item.queryProp("@id"));
-            throw MakeStringException(PKG_MISSING_DALI_LOOKUP_IP, "Could not lookup SubFiles in package %s because no remote dali ip was specified", superfile.get());
-        }
-        Owned<IPropertyTreeIterator> super_iter = item.getElements("SuperFile");
-        ForEach(*super_iter)
-        {
-            IPropertyTree &supertree = super_iter->query();
-            Owned<IPropertyTreeIterator> sub_iter = supertree.getElements("SubFile");
-            ForEach(*sub_iter)
-            {
-                IPropertyTree &subtree = sub_iter->query();
-                StringAttr subid = subtree.queryProp("@value");
-                if (subid.length())
-                {
-                    StringBuffer msg;
-                    addFileInfoToDali(subid.get(), lookupDaliIp, target, overwrite, userdesc, host, port, msg);
-                }
-            }
-        }
-    }
-}
-
 void getPackageListInfo(IPropertyTree *mapTree, IEspPackageListMapData *pkgList)
 {
     pkgList->setId(mapTree->queryProp("@id"));
@@ -624,36 +531,3 @@ bool CWsPackageProcessEx::onGetPackage(IEspContext &context, IEspGetPackageReque
     resp.setInfo(info);
     return true;
 }
-
-bool CWsPackageProcessEx::onCopyFiles(IEspContext &context, IEspCopyFilesRequest &req, IEspCopyFilesResponse &resp)
-{
-    resp.updateStatus().setCode(0);
-    StringBuffer info(req.getInfo());
-    StringAttr target(req.getTarget());
-    StringAttr pkgName(req.getPackageName());
-    StringAttr lookupDaliIp(req.getDaliIp());
-
-    if (target.length() == 0)
-        throw MakeStringException(PKG_MISSING_PARAM, "CWsPackageProcessEx::onCopyFiles process parameter not set.");
-
-    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 host;
-    short port;
-    context.getServAddress(host, port);
-
-    Owned<IPropertyTree> packageTree = createPTreeFromXMLString(info.str());
-    copyPackageSubFiles(LINK(packageTree), target, lookupDaliIp.get(), req.getOverWrite(), userdesc, host, port);
-
-    StringBuffer msg;
-    msg.append("Successfully loaded ").append(pkgName.get());
-    resp.updateStatus().setDescription(msg.str());
-    return true;
-}

+ 0 - 1
esp/services/ws_packageprocess/ws_packageprocessService.hpp

@@ -51,7 +51,6 @@ public:
     virtual bool onDeActivatePackage(IEspContext &context, IEspDeActivatePackageRequest &req, IEspDeActivatePackageResponse &resp);
     virtual bool onListPackage(IEspContext &context, IEspListPackageRequest &req, IEspListPackageResponse &resp);
     virtual bool onGetPackage(IEspContext &context, IEspGetPackageRequest &req, IEspGetPackageResponse &resp);
-    virtual bool onCopyFiles(IEspContext &context, IEspCopyFilesRequest &req, IEspCopyFilesResponse &resp);
 };
 
 #endif //_ESPWIZ_ws_packageprocess_HPP__