Skip to content

Commit

Permalink
HPCC-18038 Remove the version option from the publish and java command
Browse files Browse the repository at this point in the history
- For publish and java commands, remove the version option and don't
  pass in version when loading dependencies
- Don't validate version command option for publish and java
- Remove the --version option from the batch file for ECL IDE
- Remove the --version from ReadMeFirst.txt help file
- Refactor the variable name optVersion to optDefinitionVersion for publish
  and optInterfaceVersion for xsd and wsdl

Signed-off-by: mayx <yanrui.ma@lexisnexisrisk.com>
  • Loading branch information
mayx committed Aug 2, 2017
1 parent f23e47f commit c48acde
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 74 deletions.
4 changes: 2 additions & 2 deletions clienttools/IDEPlugins/ESDL/esdl.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ for /f "tokens=1,2,3 delims=/:" %%a in ("%8") do set http=%%a&set server=%%b&set
echo.server: %server% >> %TMP%\log.txt
echo.port : %port% >> %TMP%\log.txt

echo "%clienttoolsbindir%\esdl.exe publish %newinput% %2 --server %server% --port %port% --version 1.0 --username %6 --password %9 -v" >>%TMP%\log.txt
"%clienttoolsbindir%"\esdl.exe publish %newinput% %2 --server %server% --port %port% --version 1.0 --username %6 --password %9 -v 2>%5 >>%TMP%\log.txt
echo "%clienttoolsbindir%\esdl.exe publish %newinput% %2 --server %server% --port %port% --username %6 --password %9 -v" >>%TMP%\log.txt
"%clienttoolsbindir%"\esdl.exe publish %newinput% %2 --server %server% --port %port% --username %6 --password %9 -v 2>%5 >>%TMP%\log.txt
goto end

:genecl
Expand Down
2 changes: 1 addition & 1 deletion esp/esdllib/esdl_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ void EsdlDefinition::walkDefinitionDepthFirst( AddedObjs& foundByName, EsdlDefOb
// ancestors- they've already been added.
// Checking up front here will also allow us to detect cycles in the strcuture
// graph -such as we have with BpsReportRelative- and avoid an infinite loop
if( found || esdlObj->checkOptional(opts) == false || esdlObj->checkVersion(requestedVer) == false )
if (found || esdlObj->checkOptional(opts) == false || (requestedVer != 0.0 && esdlObj->checkVersion(requestedVer) == false))
{
//DBGLOG("%s</%s><Skipped/>", indent.str(), esdlObj->queryName());
return;
Expand Down
4 changes: 2 additions & 2 deletions initfiles/examples/EsdlExample/ReadMeFirst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Make a copy of the /opt/HPCCSystems/examples/EsdlExample folder.
From EsdlExample copy folder:

1. Generate java base classes (and dummy implementation file):
esdl java esdl_example.esdl EsdlExample --version=9
esdl java esdl_example.esdl EsdlExample

2. Compile java base classes and example service (must have sudo access to place the classes in the default HPCC class location):
sudo javac -g EsdlExampleServiceBase.java -cp /opt/HPCCSystems/classes -d /opt/HPCCSystems/classes/
Expand All @@ -37,7 +37,7 @@ esdl ecl esdl_example.esdl .
ecl publish roxie RoxieEchoPersonInfo.ecl

5. Publish the esdl defined service to dynamicESDL:
esdl publish esdl_example.esdl EsdlExample --version 9 --overwrite
esdl publish esdl_example.esdl EsdlExample --overwrite

5. Bind both java and roxie implementations to DynamicESDL
esdl bind-service myesp 8088 esdlexample.1 EsdlExample --config esdl_binding.xml --overwrite
Expand Down
50 changes: 17 additions & 33 deletions tools/esdlcmd/esdl-publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class EsdlPublishCmdCommon : public EsdlCmdCommon
StringAttr optService;
StringAttr optWSProcAddress;
StringAttr optWSProcPort;
StringAttr optVersionStr;
double optVersion;
StringAttr optDefinitionVersionStr;
int optDefinitionVersion;
StringAttr optUser;
StringAttr optPass;
StringAttr optESDLDefID;
Expand Down Expand Up @@ -79,7 +79,6 @@ class EsdlPublishCmdCommon : public EsdlCmdCommon
" --port <port> WsESDLConfig service port\n"
" -u, --username <name> Username for accessing WsESDLConfig service\n"
" -pw, --password <pw> Password for accessing WsESDLConfig service\n"
" --version <ver> ESDL service version\n"
);
EsdlCmdCommon::usage();
}
Expand All @@ -94,8 +93,6 @@ class EsdlPublishCmdCommon : public EsdlCmdCommon
return true;
if (iter.matchFlag(optWSProcPort, ESDL_OPTION_SERVICE_PORT) || iter.matchFlag(optWSProcPort, ESDL_OPT_SERVICE_PORT))
return true;
if (iter.matchFlag(optVersionStr, ESDLOPT_VERSION))
return true;
if (iter.matchFlag(optUser, ESDL_OPT_SERVICE_USER) || iter.matchFlag(optUser, ESDL_OPTION_SERVICE_USER))
return true;
if (iter.matchFlag(optPass, ESDL_OPT_SERVICE_PASS) || iter.matchFlag(optPass, ESDL_OPTION_SERVICE_PASS))
Expand Down Expand Up @@ -127,7 +124,7 @@ class EsdlPublishCmd : public EsdlPublishCmdCommon
Owned<IClientPublishESDLDefinitionRequest> request = esdlConfigClient->createPublishESDLDefinitionRequest();

StringBuffer esxml;
esdlHelper->getServiceESXDL(optSource.get(), optESDLService.get(), esxml, optVersion);
esdlHelper->getServiceESXDL(optSource.get(), optESDLService.get(), esxml, 0);

if (esxml.length()==0)
{
Expand All @@ -152,7 +149,7 @@ class EsdlPublishCmd : public EsdlPublishCmdCommon
return 1;
}

fprintf(stdout, "\nESDL Service: %s(%f): %s", optESDLService.get() ,optVersion, resp->getStatus().getDescription());
fprintf(stdout, "\nESDL Service: %s: %s", optESDLService.get(), resp->getStatus().getDescription());

return 0;
}
Expand Down Expand Up @@ -229,19 +226,6 @@ class EsdlPublishCmd : public EsdlPublishCmdCommon

bool finalizeOptions(IProperties *globals)
{
if (!optVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
{
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
}
}
else
{
fprintf(stderr, "\nWARNING: ESDL Version not specified.\n");
}

if (optSource.isEmpty())
throw MakeStringException( 0, "Source ESDL definition file (ecm|esdl|xml) must be provided" );

Expand Down Expand Up @@ -558,10 +542,10 @@ class EsdlDeleteESDLDefCmd : public EsdlPublishCmdCommon
Owned<IClientWsESDLConfig> esdlConfigClient = EsdlCmdHelper::getWsESDLConfigSoapService(optWSProcAddress, optWSProcPort, optUser, optPass);
Owned<IClientDeleteESDLDefinitionRequest> request = esdlConfigClient->createDeleteESDLDefinitionRequest();

fprintf(stdout,"\nAttempting to delete ESDL definition: '%s.%d'\n", optESDLService.get(), (int)optVersion);
fprintf(stdout,"\nAttempting to delete ESDL definition: '%s.%d'\n", optESDLService.get(), optDefinitionVersion);

StringBuffer id;
id.setf("%s.%d", optESDLService.get(), (int)optVersion);
id.setf("%s.%d", optESDLService.get(), optDefinitionVersion);

request->setId(id);

Expand Down Expand Up @@ -615,7 +599,7 @@ class EsdlDeleteESDLDefCmd : public EsdlPublishCmdCommon
optESDLService.set(arg);
break;
case 1:
optVersionStr.set(arg);
optDefinitionVersionStr.set(arg);
break;
}
}
Expand Down Expand Up @@ -655,12 +639,12 @@ class EsdlDeleteESDLDefCmd : public EsdlPublishCmdCommon
if (optESDLService.isEmpty())
throw MakeStringException( 0, "Name of ESDL service definition must be provided!" );

if (!optVersionStr.isEmpty())
if (!optDefinitionVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
optDefinitionVersion = atoi( optDefinitionVersionStr.get() );
if (optDefinitionVersion <= 0)
{
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
throw MakeStringException( 0, "ESDL service definition version must be a positive integer!" );
}
}
else
Expand Down Expand Up @@ -823,7 +807,7 @@ class EsdlBindMethodCmd : public EsdlBindServiceCmd
request->setEspProcName(optTargetESPProcName);
request->setEspBindingName(optBindingName);
request->setEsdlServiceName(optService.get());
VStringBuffer id("%s.%d", optService.get(), (int)optVersion);
VStringBuffer id("%s.%d", optService.get(), optDefinitionVersion);
request->setEsdlDefinitionID(id.str());
request->setConfig(optInput);
request->setOverwrite(optOverWrite);
Expand Down Expand Up @@ -904,7 +888,7 @@ class EsdlBindMethodCmd : public EsdlBindServiceCmd
optService.set(arg);
break;
case 3:
optVersionStr.set(arg);
optDefinitionVersionStr.set(arg);
break;
case 4:
optMethod.set(arg);
Expand Down Expand Up @@ -947,12 +931,12 @@ class EsdlBindMethodCmd : public EsdlBindServiceCmd
}
}

if (!optVersionStr.isEmpty())
if (!optDefinitionVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
optDefinitionVersion = atoi( optDefinitionVersionStr.get() );
if (optDefinitionVersion <= 0)
{
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
throw MakeStringException( 0, "ESDL service definition version must be a positive integer!" );
}
}
else
Expand Down
2 changes: 2 additions & 0 deletions tools/esdlcmd/esdlcmd_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ typedef IEsdlCommand *(*EsdlCommandFactory)(const char *cmdname);
#define ESDLOPT_XSLT_PATH "--xslt"

#define ESDLOPT_VERSION "--version"
#define ESDLOPT_INTERFACE_VERSION "--interface-version"
#define ESDLOPT_IV "-iv"
#define ESDLOPT_SERVICE "--service"
#define ESDLOPT_METHOD "--method"
#define ESDLOPT_PREPROCESS_OUT "--preprocess-output"
Expand Down
54 changes: 21 additions & 33 deletions tools/esdlcmd/esdlcmd_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class Esdl2XSDCmd : public EsdlHelperConvertCmd
{
public:
Esdl2XSDCmd() : optVersion(0), optAllAnnot(false), optNoAnnot(false),
Esdl2XSDCmd() : optInterfaceVersion(0), optAllAnnot(false), optNoAnnot(false),
optEnforceOptional(true), optRawOutput(false), optXformTimes(1), optFlags(DEPFLAG_COLLAPSE|DEPFLAG_ARRAYOF),
outfileext(".xsd")
{}
Expand Down Expand Up @@ -85,7 +85,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd

virtual bool parseCommandLineOption(ArgvIterator &iter)
{
if (iter.matchOption(optVersionStr, ESDLOPT_VERSION))
if (iter.matchOption(optInterfaceVersionStr, ESDLOPT_INTERFACE_VERSION) || iter.matchOption(optInterfaceVersionStr, ESDLOPT_IV))
return true;
if (iter.matchOption(optService, ESDLOPT_SERVICE))
return true;
Expand Down Expand Up @@ -135,10 +135,10 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
throw( MakeStringException(0, "A service name must be provided") );
}

if (!optVersionStr.isEmpty())
if (!optInterfaceVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
optInterfaceVersion = atof( optInterfaceVersionStr.get() );
if ( optInterfaceVersion <= 0 )
{
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
}
Expand Down Expand Up @@ -197,7 +197,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &target, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
{
TimeSection ts("transforming via XSLT");
cmdHelper.defHelper->toXSD( objs, target, EsdlXslToXsd, optVersion, opts, NULL, optFlags );
cmdHelper.defHelper->toXSD( objs, target, EsdlXslToXsd, optInterfaceVersion, opts, NULL, optFlags );
}

virtual void loadTransform( StringBuffer &xsltpath, IProperties *params)
Expand All @@ -216,7 +216,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
loadServiceDef();
createOptionals();

Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optVersion, opts.get(), optFlags );
Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optInterfaceVersion, opts.get(), optFlags );

if( optRawOutput )
{
Expand All @@ -231,7 +231,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd

for( unsigned i=0; i < optXformTimes; i++ )
{
doTransform( *structs, outputBuffer, optVersion, opts.get(), NULL, optFlags );
doTransform( *structs, outputBuffer, optInterfaceVersion, opts.get(), NULL, optFlags );
}

outputToFile();
Expand All @@ -249,7 +249,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
void printOptions()
{
puts("Options:");
puts(" --version <version number> : Constrain to interface version");
puts(" -iv,--interface-version <version number> : Constrain to interface version");
puts(" --method <method name>[;<method name>]* : Constrain to list of specific method(s)" );
puts(" --xslt <xslt file path> : Path to '/xslt/esxdl2xsd.xslt' file to transform EsdlDef to XSD" );
puts(" --preprocess-output <raw output directory> : Output pre-processed xml file to specified directory before applying XSLT transform" );
Expand Down Expand Up @@ -293,7 +293,7 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
StringBuffer empty;

xmlOut.appendf( "<esxdl name=\"%s\">", optService.get());
cmdHelper.defHelper->toXML( obj, xmlOut, optVersion, opts.get(), optFlags );
cmdHelper.defHelper->toXML( obj, xmlOut, optInterfaceVersion, opts.get(), optFlags );
xmlOut.append("</esxdl>");

saveAsFile( optPreprocessOutputDir.get(), empty, xmlOut.str(), NULL );
Expand Down Expand Up @@ -414,8 +414,8 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
ns.append('(').append(ns_optionals.str()).append(')');
*/

if (optVersion > 0)
ns.append("@ver=").appendf("%g", optVersion);
if (optInterfaceVersion > 0)
ns.append("@ver=").appendf("%g", optInterfaceVersion);
return ns.toLowerCase();
}

Expand Down Expand Up @@ -472,8 +472,8 @@ class Esdl2XSDCmd : public EsdlHelperConvertCmd
StringAttr optTargetNamespace;
StringAttr optPreprocessOutputDir;
bool optRawOutput;
StringAttr optVersionStr;
double optVersion;
StringAttr optInterfaceVersionStr;
double optInterfaceVersion;
unsigned int optXformTimes;
unsigned optFlags;
bool optNoCollapse;
Expand Down Expand Up @@ -523,7 +523,7 @@ class Esdl2WSDLCmd : public Esdl2XSDCmd
virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &target, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
{
TimeSection ts("transforming via XSLT");
cmdHelper.defHelper->toWSDL(objs, target, EsdlXslToWsdl, optVersion, opts, NULL, optFlags);
cmdHelper.defHelper->toWSDL(objs, target, EsdlXslToWsdl, optInterfaceVersion, opts, NULL, optFlags);
}

virtual void loadTransform( StringBuffer &xsltpath, IProperties *params)
Expand All @@ -542,7 +542,7 @@ class Esdl2WSDLCmd : public Esdl2XSDCmd
loadServiceDef();
createOptionals();

Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optVersion, opts.get(), optFlags );
Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optInterfaceVersion, opts.get(), optFlags );

if( optRawOutput )
{
Expand All @@ -556,7 +556,7 @@ class Esdl2WSDLCmd : public Esdl2XSDCmd

for( unsigned i=0; i < optXformTimes; i++ )
{
doTransform( *structs, outputBuffer, optVersion, opts.get(), NULL, optFlags );
doTransform( *structs, outputBuffer, optInterfaceVersion, opts.get(), NULL, optFlags );
}

outputToFile();
Expand Down Expand Up @@ -616,7 +616,7 @@ class Esdl2WSDLCmd : public Esdl2XSDCmd
class Esdl2JavaCmd : public EsdlHelperConvertCmd
{
public:
Esdl2JavaCmd() : optVersion(0), optFlags(0)
Esdl2JavaCmd() : optFlags(0)
{}

virtual bool parseCommandLineOptions(ArgvIterator &iter)
Expand Down Expand Up @@ -668,8 +668,6 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd

virtual bool parseCommandLineOption(ArgvIterator &iter)
{
if (iter.matchOption(optVersionStr, ESDLOPT_VERSION))
return true;
if (iter.matchOption(optService, ESDLOPT_SERVICE))
return true;
if (iter.matchOption(optMethod, ESDLOPT_METHOD))
Expand Down Expand Up @@ -703,13 +701,6 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd
throw( MakeStringException(0, "A service name must be provided") );
}

if (!optVersionStr.isEmpty())
{
optVersion = atof( optVersionStr.get() );
if( optVersion <= 0 )
throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
}

if (!optXsltPath.length())
{
StringBuffer binXsltPath;
Expand Down Expand Up @@ -738,8 +729,8 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd

virtual int processCMD()
{
cmdHelper.loadDefinition(optSource, optService, optVersion);
Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService, optMethod, ESDLOPTLIST_DELIMITER, optVersion, NULL, optFlags );
cmdHelper.loadDefinition(optSource, optService, 0);
Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService, optMethod, ESDLOPTLIST_DELIMITER, 0, NULL, optFlags );

if(!optPreprocessOutputDir.isEmpty())
{
Expand Down Expand Up @@ -768,7 +759,6 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd
void printOptions()
{
puts("Options:");
puts(" --version <version number> : Constrain to interface version");
puts(" --method <method name>[;<method name>]* : Constrain to list of specific method(s)" );
puts(" --xslt <xslt file path> : Path to xslt files used to transform EsdlDef to Java code" );
puts(" --preprocess-output <raw output directory> : Output pre-processed xml file to specified directory before applying XSLT transform" );
Expand Down Expand Up @@ -798,7 +788,7 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd
StringBuffer xml;

xml.appendf( "<esxdl name='%s'>", optService.get());
cmdHelper.defHelper->toXML( obj, xml, optVersion, NULL, optFlags );
cmdHelper.defHelper->toXML( obj, xml, 0, NULL, optFlags );
xml.append("</esxdl>");
saveAsFile(optPreprocessOutputDir, NULL, xml, NULL );
}
Expand Down Expand Up @@ -836,8 +826,6 @@ class Esdl2JavaCmd : public EsdlHelperConvertCmd
StringAttr optXsltPath;
StringAttr optMethod;
StringAttr optPreprocessOutputDir;
StringAttr optVersionStr;
double optVersion;
unsigned optFlags;

protected:
Expand Down

0 comments on commit c48acde

Please sign in to comment.