Browse Source

HPCC-2197 Ecl package command line parameters need to be more consistent

Code changes based on code review comments

Signed-off-by: Stuart Ort <stuart.ort@lexisnexis.com>
Stuart Ort 12 years ago
parent
commit
039ac97085

+ 30 - 43
ecl/ecl-package/ecl-package.cpp

@@ -28,11 +28,6 @@
 #include "eclcmd_common.hpp"
 #include "eclcmd_common.hpp"
 #include "eclcmd_core.hpp"
 #include "eclcmd_core.hpp"
 
 
-#define ECLOPT_OVERWRITE "--overwrite"
-#define ECLOPT_OVERWRITE_S "-O"
-#define ECLOPT_PACKAGE "--packagename"
-#define ECLOPT_PACKAGESETID "--packagesetid"
-
 //=========================================================================================
 //=========================================================================================
 
 
 IClientWsPackageProcess *getWsPackageSoapService(const char *server, const char *port, const char *username, const char *password)
 IClientWsPackageProcess *getWsPackageSoapService(const char *server, const char *port, const char *username, const char *password)
@@ -109,7 +104,7 @@ public:
 
 
         Owned<IClientActivatePackageRequest> request = packageProcessClient->createActivatePackageRequest();
         Owned<IClientActivatePackageRequest> request = packageProcessClient->createActivatePackageRequest();
         request->setTarget(optTarget);
         request->setTarget(optTarget);
-        request->setPackageMapName(optPackageMap);
+        request->setPackageMap(optPackageMap);
 
 
         Owned<IClientActivatePackageResponse> resp = packageProcessClient->ActivatePackage(request);
         Owned<IClientActivatePackageResponse> resp = packageProcessClient->ActivatePackage(request);
         if (resp->getExceptions().ordinality())
         if (resp->getExceptions().ordinality())
@@ -122,9 +117,9 @@ public:
         fputs("\nUsage:\n"
         fputs("\nUsage:\n"
                     "\n"
                     "\n"
                     "The 'activate' command will deactivate the currently activate packagmap \n"
                     "The 'activate' command will deactivate the currently activate packagmap \n"
-                    "and make the specified package the one that is used.\n"
+                    "and make the specified packagemap the one that is used.\n"
                     "\n"
                     "\n"
-                    "ecl package activate <target> <packagemap>\n"
+                    "ecl pakagemap activate <target> <packagemap>\n"
                     " Options:\n"
                     " Options:\n"
                     "   <target>               name of target containing package map to activate\n"
                     "   <target>               name of target containing package map to activate\n"
                     "   <packagemap>           packagemap to activate\n",
                     "   <packagemap>           packagemap to activate\n",
@@ -196,7 +191,7 @@ public:
 
 
         Owned<IClientDeActivatePackageRequest> request = packageProcessClient->createDeActivatePackageRequest();
         Owned<IClientDeActivatePackageRequest> request = packageProcessClient->createDeActivatePackageRequest();
         request->setTarget(optTarget);
         request->setTarget(optTarget);
-        request->setPackageMapName(optPackageMap);
+        request->setPackageMap(optPackageMap);
 
 
         Owned<IClientDeActivatePackageResponse> resp = packageProcessClient->DeActivatePackage(request);
         Owned<IClientDeActivatePackageResponse> resp = packageProcessClient->DeActivatePackage(request);
         if (resp->getExceptions().ordinality())
         if (resp->getExceptions().ordinality())
@@ -210,7 +205,7 @@ public:
                     "\n"
                     "\n"
                     "The 'deactivate' command will deactivate the currently activate packagmap \n"
                     "The 'deactivate' command will deactivate the currently activate packagmap \n"
                     "\n"
                     "\n"
-                    "ecl package deactivate <target> <packagemap>\n"
+                    "ecl pakagemap deactivate <target> <packagemap>\n"
                     " Options:\n"
                     " Options:\n"
                     "   <target>               name of target containing package map to activate\n"
                     "   <target>               name of target containing package map to activate\n"
                     "   <packagemap>           packagemap to activate\n",
                     "   <packagemap>           packagemap to activate\n",
@@ -307,9 +302,9 @@ public:
     {
     {
         fputs("\nUsage:\n"
         fputs("\nUsage:\n"
                     "\n"
                     "\n"
-                    "The 'list' command will list package information for the target cluster \n"
+                    "The 'list' command will list package map information for the target cluster \n"
                     "\n"
                     "\n"
-                    "ecl package list <target> \n"
+                    "ecl pakagemap list <target> \n"
                     " Options:\n"
                     " Options:\n"
                     "   <target>               name of target containing package map to use when retrieve list of package maps\n",
                     "   <target>               name of target containing package map to use when retrieve list of package maps\n",
                     stdout);
                     stdout);
@@ -381,11 +376,11 @@ public:
     {
     {
         fputs("\nUsage:\n"
         fputs("\nUsage:\n"
                     "\n"
                     "\n"
-                    "The 'info' command will return the contents of the active package information for the target cluster \n"
+                    "The 'info' command will return the contents of the active package map information for the target cluster \n"
                     "\n"
                     "\n"
-                    "ecl package list <target> \n"
+                    "ecl pakagemap info <target> \n"
                     " Options:\n"
                     " Options:\n"
-                    "   <target>               name of the target to use when retrieving active package information\n",
+                    "   <target>               name of the target to use when retrieving active package map information\n",
                     stdout);
                     stdout);
         EclCmdCommon::usage();
         EclCmdCommon::usage();
     }
     }
@@ -454,7 +449,7 @@ public:
     {
     {
         Owned<IClientWsPackageProcess> packageProcessClient = getWsPackageSoapService(optServer, optPort, optUsername, optPassword);
         Owned<IClientWsPackageProcess> packageProcessClient = getWsPackageSoapService(optServer, optPort, optUsername, optPassword);
 
 
-        fprintf(stdout, "\n ... deleting package %s now\n\n", optPackageMap.sget());
+        fprintf(stdout, "\n ... deleting package map %s now\n\n", optPackageMap.sget());
 
 
         Owned<IClientDeletePackageRequest> request = packageProcessClient->createDeletePackageRequest();
         Owned<IClientDeletePackageRequest> request = packageProcessClient->createDeletePackageRequest();
         request->setTarget(optTarget);
         request->setTarget(optTarget);
@@ -470,7 +465,7 @@ public:
     virtual void usage()
     virtual void usage()
     {
     {
         fprintf(stdout,"\nUsage:\n\n"
         fprintf(stdout,"\nUsage:\n\n"
-            "ecl package delete [options] [<filename>]\n\n"
+            "ecl pakagemap delete [options] [<filename>]\n\n"
             "   Options:\n"
             "   Options:\n"
             "      --queryset=<queryset>        name of queryset to associate the information\n"
             "      --queryset=<queryset>        name of queryset to associate the information\n"
         );
         );
@@ -515,8 +510,6 @@ public:
                 continue;
                 continue;
             if (iter.matchFlag(optOverWrite, ECLOPT_OVERWRITE)||iter.matchFlag(optOverWrite, ECLOPT_OVERWRITE_S))
             if (iter.matchFlag(optOverWrite, ECLOPT_OVERWRITE)||iter.matchFlag(optOverWrite, ECLOPT_OVERWRITE_S))
                 continue;
                 continue;
-            if (iter.matchOption(optPackageSetId, ECLOPT_PACKAGESETID))
-                continue;
             if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
             if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
                 return false;
                 return false;
         }
         }
@@ -542,11 +535,8 @@ public:
             return false;
             return false;
         }
         }
 
 
-        if (optPackageSetId.isEmpty())
-            optPackageSetId.set("*");
-
-        if (optPackageProcessName.isEmpty())
-            optPackageProcessName.set(optFileName);
+        if (optProcess.isEmpty())
+            optProcess.set("*");
 
 
         return true;
         return true;
     }
     }
@@ -556,15 +546,14 @@ public:
         StringBuffer pkgInfo;
         StringBuffer pkgInfo;
         pkgInfo.loadFile(optFileName);
         pkgInfo.loadFile(optFileName);
 
 
-        fprintf(stdout, "\n ... adding package %s now\n\n", optFileName.sget());
+        fprintf(stdout, "\n ... adding package map %s now\n\n", optFileName.sget());
 
 
         Owned<IClientAddPackageRequest> request = packageProcessClient->createAddPackageRequest();
         Owned<IClientAddPackageRequest> request = packageProcessClient->createAddPackageRequest();
         request->setActivate(optActivate);
         request->setActivate(optActivate);
         request->setInfo(pkgInfo);
         request->setInfo(pkgInfo);
         request->setTarget(optTarget);
         request->setTarget(optTarget);
         request->setPackageMap(optFileName);
         request->setPackageMap(optFileName);
-        request->setPackageProcessName(optPackageProcessName);
-        request->setPackageSetId(optPackageSetId);
+        request->setProcess(optProcess);
 
 
         Owned<IClientAddPackageResponse> resp = packageProcessClient->AddPackage(request);
         Owned<IClientAddPackageResponse> resp = packageProcessClient->AddPackage(request);
         if (resp->getExceptions().ordinality())
         if (resp->getExceptions().ordinality())
@@ -577,16 +566,15 @@ public:
     {
     {
         fputs("\nUsage:\n"
         fputs("\nUsage:\n"
                     "\n"
                     "\n"
-                    "The 'add' command will add the package information to dali \n"
+                    "The 'add' command will add the package map information to dali \n"
                     "\n"
                     "\n"
-                    "ecl package add [options] <target> <filename>\n"
+                    "ecl pakagemap add [options] <target> <filename>\n"
                     " Options:\n"
                     " Options:\n"
                     "   -O, --overwrite             overwrite existing information\n"
                     "   -O, --overwrite             overwrite existing information\n"
                     "   -A, --activate              activate the package information\n"
                     "   -A, --activate              activate the package information\n"
-                    "  --packagesetid               if not set use <filename>"
 // NOT-YET          "  --packageprocessname         if not set use this package process name for all clusters"
 // NOT-YET          "  --packageprocessname         if not set use this package process name for all clusters"
-                    "   <target>                    name of target to use when adding package information\n"
-                    "   <filename>                  name of file containing package information\n",
+                    "   <target>                    name of target to use when adding package map information\n"
+                    "   <filename>                  name of file containing package map information\n",
                     stdout);
                     stdout);
 
 
         EclCmdCommon::usage();
         EclCmdCommon::usage();
@@ -594,8 +582,7 @@ public:
 private:
 private:
     StringAttr optFileName;
     StringAttr optFileName;
     StringAttr optTarget;
     StringAttr optTarget;
-    StringAttr optPackageProcessName;
-    StringAttr optPackageSetId;
+    StringAttr optProcess;
     bool optActivate;
     bool optActivate;
     bool optOverWrite;
     bool optOverWrite;
     StringBuffer pkgInfo;
     StringBuffer pkgInfo;
@@ -692,7 +679,7 @@ public:
                     "The 'copyFiles' command will copy any file listed in the package that is not currently \n"
                     "The 'copyFiles' command will copy any file listed in the package that is not currently \n"
                     "known on the cluster.  This will NOT load the package information \n"
                     "known on the cluster.  This will NOT load the package information \n"
                     "\n"
                     "\n"
-                    "ecl package copyFiles [options] <target> <filename>\n"
+                    "ecl pakagemap copyFiles [options] <target> <filename>\n"
                     " Options:\n"
                     " Options:\n"
                     "   -O, --overwrite             overwrite existing information\n"
                     "   -O, --overwrite             overwrite existing information\n"
                     "  --daliip=<daliip>            ip of the source dali to use for file lookups\n"
                     "  --daliip=<daliip>            ip of the source dali to use for file lookups\n"
@@ -744,15 +731,15 @@ public:
     virtual void usage()
     virtual void usage()
     {
     {
         fprintf(stdout,"\nUsage:\n\n"
         fprintf(stdout,"\nUsage:\n\n"
-            "ecl package <command> [command options]\n\n"
-            "   Package Commands:\n"
-            "      add          add a package to the environment\n"
+            "ecl pakagemap <command> [command options]\n\n"
+            "   packagemap Commands:\n"
+            "      add          add a package map to the environment\n"
             "      copyFiles    copy missing data files to the appropriate cluster\n"
             "      copyFiles    copy missing data files to the appropriate cluster\n"
-            "      delete       delete a package\n"
-            "      activate     activate a package\n"
-            "      deactivate   deactivate a package (package will not get loaded)\n"
-            "      list         list loaded package names\n"
-            "      info         return active package information for a cluster\n"
+            "      delete       delete a packag emap\n"
+            "      activate     activate a package map\n"
+            "      deactivate   deactivate a package map (package map will not get loaded)\n"
+            "      list         list loaded package map names\n"
+            "      info         return active package map information for a cluster\n"
         );
         );
     }
     }
 };
 };

+ 3 - 4
esp/scm/ws_packageprocess.ecm

@@ -26,8 +26,7 @@ ESPrequest AddPackageRequest
     boolean OverWrite;
     boolean OverWrite;
     string Target;
     string Target;
     string PackageMap;
     string PackageMap;
-    string PackageProcessName;
-    string PackageSetId;
+    string Process;
 };
 };
 
 
 
 
@@ -50,7 +49,7 @@ ESPresponse [exceptions_inline] DeletePackageResponse
 ESPrequest ActivatePackageRequest
 ESPrequest ActivatePackageRequest
 {
 {
     string Target;
     string Target;
-    string PackageMapName;
+    string PackageMap;
 };
 };
 
 
 ESPresponse [exceptions_inline] ActivatePackageResponse
 ESPresponse [exceptions_inline] ActivatePackageResponse
@@ -61,7 +60,7 @@ ESPresponse [exceptions_inline] ActivatePackageResponse
 ESPrequest DeActivatePackageRequest
 ESPrequest DeActivatePackageRequest
 {
 {
     string Target;
     string Target;
-    string PackageMapName;
+    string PackageMap;
 };
 };
 
 
 ESPresponse [exceptions_inline] DeActivatePackageResponse
 ESPresponse [exceptions_inline] DeActivatePackageResponse

+ 8 - 6
esp/services/ws_packageprocess/ws_packageprocessService.cpp

@@ -479,12 +479,14 @@ bool CWsPackageProcessEx::onAddPackage(IEspContext &context, IEspAddPackageReque
     bool overWrite = req.getOverWrite();
     bool overWrite = req.getOverWrite();
     StringAttr target(req.getTarget());
     StringAttr target(req.getTarget());
     StringAttr pkgMapName(req.getPackageMap());
     StringAttr pkgMapName(req.getPackageMap());
-    StringAttr pkgSetId(req.getPackageSetId());
-    StringAttr pkgProcessName(req.getPackageProcessName());
+    StringAttr processName(req.getProcess());
+
+    VStringBuffer pkgSetId("default_%s", processName.get());
+    pkgSetId.replace('*', '_');
 
 
     Owned<IPropertyTree> packageTree = createPTreeFromXMLString(info.str());
     Owned<IPropertyTree> packageTree = createPTreeFromXMLString(info.str());
-    Owned<IPropertyTree> pkgSetRegistry = getPkgSetRegistry(pkgSetId.get(), pkgProcessName.get(), false);
-    addPackageMapInfo(pkgSetRegistry, target.get(), pkgMapName.get(), pkgSetId.get(), LINK(packageTree), activate, overWrite);
+    Owned<IPropertyTree> pkgSetRegistry = getPkgSetRegistry(pkgSetId.str(), processName.get(), false);
+    addPackageMapInfo(pkgSetRegistry, target.get(), pkgMapName.get(), pkgSetId.str(), LINK(packageTree), activate, overWrite);
 
 
     StringBuffer msg;
     StringBuffer msg;
     msg.append("Successfully loaded ").append(pkgMapName.get());
     msg.append("Successfully loaded ").append(pkgMapName.get());
@@ -509,7 +511,7 @@ bool CWsPackageProcessEx::onActivatePackage(IEspContext &context, IEspActivatePa
 {
 {
     resp.updateStatus().setCode(0);
     resp.updateStatus().setCode(0);
     StringBuffer target(req.getTarget());
     StringBuffer target(req.getTarget());
-    StringBuffer pkgMapName(req.getPackageMapName());
+    StringBuffer pkgMapName(req.getPackageMap());
 
 
     activatePackageMapInfo(target.str(), pkgMapName.str(), true);
     activatePackageMapInfo(target.str(), pkgMapName.str(), true);
     return true;
     return true;
@@ -519,7 +521,7 @@ bool CWsPackageProcessEx::onDeActivatePackage(IEspContext &context, IEspDeActiva
 {
 {
     resp.updateStatus().setCode(0);
     resp.updateStatus().setCode(0);
     StringBuffer target(req.getTarget());
     StringBuffer target(req.getTarget());
-    StringBuffer pkgMapName(req.getPackageMapName());
+    StringBuffer pkgMapName(req.getPackageMap());
 
 
     activatePackageMapInfo(target.str(), pkgMapName.str(), false);
     activatePackageMapInfo(target.str(), pkgMapName.str(), false);
     return true;
     return true;