esdlcmd_core.cpp 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #include <stdio.h>
  14. #include "jlog.hpp"
  15. #include "jfile.hpp"
  16. #include "jargv.hpp"
  17. #include "esdlcmd_common.hpp"
  18. #include "esdlcmd_core.hpp"
  19. #include "esdl2ecl.cpp"
  20. #include "esdl-publish.cpp"
  21. class Esdl2XSDCmd : public EsdlHelperConvertCmd
  22. {
  23. public:
  24. Esdl2XSDCmd() : optUnversionedNamespace(false), optInterfaceVersion(0), optAllAnnot(false), optNoAnnot(false),
  25. optEnforceOptional(true), optRawOutput(false), optXformTimes(1), optFlags(DEPFLAG_COLLAPSE|DEPFLAG_ARRAYOF),
  26. outfileext(".xsd")
  27. {}
  28. virtual bool parseCommandLineOptions(ArgvIterator &iter)
  29. {
  30. if (iter.done())
  31. {
  32. usage();
  33. return false;
  34. }
  35. //First two parameters' order is fixed.
  36. for (int par = 0; par < 2 && !iter.done(); par++)
  37. {
  38. const char *arg = iter.query();
  39. if (*arg != '-')
  40. {
  41. if (optSource.isEmpty())
  42. optSource.set(arg);
  43. else if (optService.isEmpty())
  44. optService.set(arg);
  45. else
  46. {
  47. fprintf(stderr, "\nunrecognized argument detected before required parameters: %s\n", arg);
  48. usage();
  49. return false;
  50. }
  51. }
  52. else
  53. {
  54. fprintf(stderr, "\noption detected before required parameters: %s\n", arg);
  55. usage();
  56. return false;
  57. }
  58. iter.next();
  59. }
  60. for (; !iter.done(); iter.next())
  61. {
  62. if (parseCommandLineOption(iter))
  63. continue;
  64. if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
  65. return false;
  66. }
  67. return true;
  68. }
  69. virtual bool parseCommandLineOption(ArgvIterator &iter)
  70. {
  71. if (iter.matchFlag(optUnversionedNamespace, ESDLOPT_UNVERSIONED_NAMESPACE) || iter.matchFlag(optUnversionedNamespace, ESDLOPT_UNVERSIONED_NAMESPACE_S))
  72. return true;
  73. if (iter.matchOption(optInterfaceVersionStr, ESDLOPT_INTERFACE_VERSION) || iter.matchOption(optInterfaceVersionStr, ESDLOPT_INTERFACE_VERSION_S))
  74. return true;
  75. if (iter.matchOption(optService, ESDLOPT_SERVICE))
  76. return true;
  77. if (iter.matchOption(optMethod, ESDLOPT_METHOD))
  78. return true;
  79. if (iter.matchOption(optXsltPath, ESDLOPT_XSLT_PATH))
  80. return true;
  81. if (iter.matchOption(optPreprocessOutputDir, ESDLOPT_PREPROCESS_OUT))
  82. return true;
  83. if (iter.matchOption(optAnnotate, ESDLOPT_ANNOTATE))
  84. return true;
  85. if (iter.matchOption(optTargetNamespace, ESDLOPT_TARGET_NAMESPACE) || iter.matchOption(optTargetNamespace, ESDLOPT_TARGET_NS))
  86. return true;
  87. if (iter.matchOption(optOptional, ESDLOPT_OPT_PARAM_VAL) || iter.matchOption(optOptional, ESDLOPT_OPTIONAL_PARAM_VAL))
  88. return true;
  89. if (iter.matchFlag(optEnforceOptional, ESDLOPT_NO_OPTIONAL_ATTRIBUTES))
  90. return true;
  91. if (iter.matchOption(optXformTimes, ESDLOPT_NUMBER))
  92. return true;
  93. if (iter.matchFlag(optNoCollapse, ESDLOPT_NO_COLLAPSE))
  94. return true;
  95. if (iter.matchFlag(optNoArrayOf, ESDLOPT_NO_ARRAYOF))
  96. return true;
  97. StringAttr oneOption;
  98. if (iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH) || iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH_S))
  99. return false; //Return false to negate allowing the include path options from parent class
  100. if (iter.matchFlag(optNoExceptionsInline, ESDLOPT_NO_EXCEPT_INLINE))
  101. return true;
  102. if (EsdlConvertCmd::parseCommandLineOption(iter))
  103. return true;
  104. return false;
  105. }
  106. esdlCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
  107. {
  108. return EsdlConvertCmd::matchCommandLineOption(iter, true);
  109. }
  110. virtual bool finalizeOptions(IProperties *globals)
  111. {
  112. if (optSource.isEmpty())
  113. {
  114. usage();
  115. throw( MakeStringException(0, "\nError: Source esdl parameter required\n"));
  116. }
  117. if( optService.isEmpty() )
  118. {
  119. usage();
  120. throw( MakeStringException(0, "A service name must be provided") );
  121. }
  122. if (!optInterfaceVersionStr.isEmpty())
  123. {
  124. optInterfaceVersion = atof( optInterfaceVersionStr.get() );
  125. if ( optInterfaceVersion <= 0 )
  126. {
  127. throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
  128. }
  129. }
  130. if (optXsltPath.isEmpty())
  131. {
  132. StringBuffer tmp;
  133. if (getComponentFilesRelPathFromBin(tmp))
  134. optXsltPath.set(tmp.str());
  135. else
  136. optXsltPath.set(hpccBuildInfo.componentDir);
  137. }
  138. fullxsltpath.set(optXsltPath);
  139. fullxsltpath.append("/xslt/esxdl2xsd.xslt");
  140. if (!optPreprocessOutputDir.isEmpty())
  141. optRawOutput = true;
  142. if (!optAnnotate.isEmpty())
  143. {
  144. if (strcmp (optAnnotate.get(), "all") ==0)
  145. {
  146. optAllAnnot = true;
  147. }
  148. else if (strcmp (optAnnotate.get(), "none") ==0)
  149. {
  150. optNoAnnot = true;
  151. }
  152. else
  153. {
  154. throw MakeStringException( 0, "--annotate option must be followed by 'all' or 'none' " );
  155. }
  156. }
  157. if (optNoCollapse)
  158. {
  159. unsetFlag(DEPFLAG_COLLAPSE);
  160. }
  161. if(optNoArrayOf)
  162. {
  163. unsetFlag(DEPFLAG_ARRAYOF);
  164. }
  165. if(optTargetNamespace.isEmpty())
  166. {
  167. optTargetNamespace.set(DEFAULT_NAMESPACE_BASE);
  168. }
  169. cmdHelper.verbose = optVerbose;
  170. return true;
  171. }
  172. virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &target, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
  173. {
  174. TimeSection ts("transforming via XSLT");
  175. cmdHelper.defHelper->toXSD( objs, target, EsdlXslToXsd, optInterfaceVersion, opts, NULL, optFlags );
  176. }
  177. virtual void loadTransform( StringBuffer &xsltpath, IProperties *params)
  178. {
  179. TimeSection ts("loading XSLT");
  180. cmdHelper.defHelper->loadTransform( xsltpath, params, EsdlXslToXsd );
  181. }
  182. virtual void setTransformParams(IProperties *params )
  183. {
  184. cmdHelper.defHelper->setTransformParams(EsdlXslToXsd, params);
  185. }
  186. virtual int processCMD()
  187. {
  188. cmdHelper.loadDefinition(optSource, optService.get(), optInterfaceVersion,"", optTraceFlags());
  189. createOptionals();
  190. Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optInterfaceVersion, opts.get(), optFlags );
  191. if( optRawOutput )
  192. {
  193. outputRaw(*structs);
  194. }
  195. if( !optXsltPath.isEmpty() )
  196. {
  197. createParams();
  198. loadTransform( fullxsltpath, params);
  199. for( unsigned i=0; i < optXformTimes; i++ )
  200. {
  201. doTransform( *structs, outputBuffer, optInterfaceVersion, opts.get(), NULL, optFlags );
  202. }
  203. outputToFile();
  204. printf( "%s\n", outputBuffer.str() );
  205. }
  206. else
  207. {
  208. throw( MakeStringException(0, "Path to /xslt/esxdl2xsd.xslt is empty, cannot perform transform.") );
  209. }
  210. return 0;
  211. }
  212. void printOptions()
  213. {
  214. puts("Options:");
  215. puts(" -iv,--interface-version <version> Constrain to interface version");
  216. puts(" --method <meth name>[;<meth name>]* Constrain to list of specific method(s)" );
  217. puts(" --xslt <xslt file path> Path to '/xslt/esxdl2xsd.xslt' file to transform EsdlDef to XSD" );
  218. puts(" --preprocess-output <rawoutput dir> Output pre-processed xml file to specified directory before applying XSLT transform" );
  219. puts(" --annotate <all | none> Flag turning on either all annotations or none. By default annotations are generated " );
  220. puts(" for Enumerations. Setting the flag to 'none' will disable even those. Setting it" );
  221. puts(" to 'all' will enable additional annotations such as collapsed, cols, form_ui, html_head and rows.");
  222. puts(" --noopt Turns off the enforcement of 'optional' attributes on elements. If no -noopt is specified then all elements with an 'optional'" );
  223. puts(" will be included in the output. By default 'optional' filtering is enforced.");
  224. puts(" -opt,--optional <param value> Value to use for optional tag filter when gathering dependencies" );
  225. puts(" An example: passing 'internal' when some Esdl definition objects have the attribute");
  226. puts(" optional(\"internal\") will ensure they appear in the XSD, otherwise they'd be filtered out");
  227. puts(" -tns,--target-namespace <target ns> The target namespace, passed to the transform via the parameter 'tnsParam'" );
  228. puts(" used for the final output of the XSD. If not supplied will default to " );
  229. puts(" http://webservices.seisint.com/<service name>" );
  230. puts(" -uvns,--unversioned-ns Do not append service interface version to namespace" );
  231. puts(" -n <int> Number of times to run transform after loading XSLT. Defaults to 1." );
  232. puts(" --show-inheritance Turns off the collapse feature. Collapsing optimizes the XML output to strip out structures" );
  233. puts(" only used for inheritance, and collapses their elements into their child. That simplifies the" );
  234. puts(" stylesheet. By default this option is on.");
  235. puts(" --no-arrayof Supresses the use of the arrrayof element. arrayof optimizes the XML output to include 'ArrayOf...'" );
  236. puts(" structure definitions for those EsdlArray elements with no item_tag attribute. Works in conjunction" );
  237. puts(" with an optimized stylesheet that doesn't generate these itself. This defaults to on.");
  238. puts(" --no-exceptions-inline Do not modify the interface to include an Exceptions element inline in the response.");
  239. }
  240. virtual void usage()
  241. {
  242. puts("Usage:");
  243. puts("esdl xsd sourcePath serviceName [options]\n\n" );
  244. puts("sourcePath - Absolute path to ESDL definition file" );
  245. puts(" which contains ESDL Service definition." );
  246. puts("serviceName - Name of ESDL Service defined in the given definition file.\n" );
  247. printOptions();
  248. EsdlConvertCmd::usage();
  249. }
  250. virtual void outputRaw( IEsdlDefObjectIterator& obj)
  251. {
  252. if( optRawOutput )
  253. {
  254. StringBuffer xmlOut;
  255. StringBuffer empty;
  256. xmlOut.appendf( "<esxdl name=\"%s\">", optService.get());
  257. cmdHelper.defHelper->toXML( obj, xmlOut, optInterfaceVersion, opts.get(), optFlags );
  258. xmlOut.append("</esxdl>");
  259. saveAsFile( optPreprocessOutputDir.get(), empty, xmlOut.str(), NULL );
  260. }
  261. }
  262. virtual void createOptionals()
  263. {
  264. // 09jun2011 tja: We must ensure that the opts IProperties object is
  265. // valid/non-null. This is because by passing null/invalid in to the
  266. // getDependencies call we're indicating that we want to turn off
  267. // optional filtering.
  268. if( optEnforceOptional )
  269. {
  270. opts.setown(createProperties(false));
  271. if( optOptional.length() )
  272. {
  273. opts->setProp(optOptional.get(), 1);
  274. }
  275. }
  276. }
  277. void createParams()
  278. {
  279. params.set(createProperties());
  280. generateNamespace(tns);
  281. // All params are treated as expressions, so any strings must be quoted
  282. // 1/0 are not equivalent to true/false, as 0 evaluates to true
  283. setXpathQuotedParam(params, "tnsParam", tns.str());
  284. setXpathQuotedParam(params, "optional", optOptional.str());
  285. if( optAllAnnot )
  286. {
  287. params->setProp( "all_annot_Param", "true()" );
  288. }
  289. if( optNoAnnot )
  290. {
  291. params->setProp( "no_annot_Param", "true()" );
  292. }
  293. if( optNoExceptionsInline )
  294. {
  295. params->setProp( "no_exceptions_inline", "true()" );
  296. }
  297. }
  298. virtual void outputToFile()
  299. {
  300. if (!optOutDirPath.isEmpty())
  301. {
  302. StringBuffer filename;
  303. generateOutputFileName(filename);
  304. saveAsFile(optOutDirPath.get(), filename, outputBuffer.str(), NULL);
  305. }
  306. }
  307. StringBuffer & generateNamespace(StringBuffer &ns)
  308. {
  309. bool urlNamespace = false;
  310. if (startsWith(optTargetNamespace.get(), "http://"))
  311. urlNamespace = true;
  312. ns.appendf("%s%c%s", optTargetNamespace.get(), urlNamespace ? '/' : ':', optService.get());
  313. //only add methodname if single method used.
  314. if (!optMethod.isEmpty() && !strstr(optMethod.get(), ESDLOPTLIST_DELIMITER))
  315. ns.append(urlNamespace ? '/' : ':').append(optMethod.get());
  316. //todo
  317. /*
  318. StringBuffer ns_optionals;
  319. //IProperties *params = context.queryRequestParameters();
  320. Owned<IPropertyIterator> esdl_optionals = cmdHelper.esdlDef->queryOptionals()->getIterator();
  321. ForEach(*esdl_optionals)
  322. {
  323. const char *key = esdl_optionals->getPropKey();
  324. if (params->hasProp(key))
  325. {
  326. if (ns_optionals.length())
  327. ns_optionals.append(',');
  328. ns_optionals.append(key);
  329. }
  330. }
  331. if (ns_optionals.length())
  332. ns.append('(').append(ns_optionals.str()).append(')');
  333. */
  334. if (optInterfaceVersion > 0 && !optUnversionedNamespace)
  335. ns.append("@ver=").appendf("%g", optInterfaceVersion);
  336. return ns.toLowerCase();
  337. }
  338. virtual StringBuffer & generateOutputFileName( StringBuffer &filename)
  339. {
  340. filename.appendf("%s", optService.get());
  341. if (!optMethod.isEmpty() && !strstr(optMethod.get(), ESDLOPTLIST_DELIMITER))
  342. filename.append('-').append(optMethod.get());
  343. filename.append(outfileext);
  344. return filename.toLowerCase();
  345. }
  346. void saveAsFile(const char * dir, StringBuffer &outname, const char *text, const char *ext="")
  347. {
  348. StringBuffer path(dir);
  349. if( outname.length()>0 && path.charAt(path.length()) != PATHSEPCHAR && outname.charAt(0) != PATHSEPCHAR)
  350. {
  351. path.append(PATHSEPCHAR);
  352. path.append(outname);
  353. }
  354. if( ext && *ext )
  355. {
  356. path.append(ext);
  357. }
  358. Owned<IFile> file = createIFile(path.str());
  359. Owned<IFileIO> io;
  360. io.setown(file->open(IFOcreate));
  361. DBGLOG("Writing to file %s", file->queryFilename());
  362. if (io.get())
  363. io->write(0, strlen(text), text);
  364. else
  365. DBGLOG("File %s can't be created", file->queryFilename());
  366. }
  367. void setFlag( unsigned f ) { optFlags |= f; }
  368. void unsetFlag( unsigned f ) { optFlags &= ~f; }
  369. public:
  370. StringAttr optService;
  371. StringAttr optXsltPath;
  372. StringAttr optMethod;
  373. StringAttr optOptional;
  374. bool optEnforceOptional;
  375. StringAttr optAnnotate;
  376. bool optAllAnnot, optNoAnnot;
  377. StringAttr optTargetNamespace;
  378. StringAttr optPreprocessOutputDir;
  379. bool optRawOutput;
  380. StringAttr optInterfaceVersionStr;
  381. double optInterfaceVersion;
  382. unsigned int optXformTimes;
  383. unsigned optFlags;
  384. bool optNoCollapse;
  385. bool optNoArrayOf;
  386. bool optUnversionedNamespace;
  387. bool optNoExceptionsInline;
  388. protected:
  389. StringBuffer outputBuffer;
  390. StringBuffer fullxsltpath;
  391. Owned<IProperties> opts;
  392. Owned<IProperties> params;
  393. StringBuffer tns;
  394. StringBuffer outfileext;
  395. };
  396. class Esdl2WSDLCmd : public Esdl2XSDCmd
  397. {
  398. public:
  399. Esdl2WSDLCmd()
  400. {
  401. outfileext.set(".wsdl");
  402. }
  403. virtual bool parseCommandLineOption(ArgvIterator &iter)
  404. {
  405. if (iter.matchFlag(optWsdlAddress, ESDLOPT_WSDL_ADDRESS))
  406. return true;
  407. if (Esdl2XSDCmd::parseCommandLineOption(iter))
  408. return true;
  409. return false;
  410. }
  411. esdlCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
  412. {
  413. return Esdl2XSDCmd::matchCommandLineOption(iter, true);
  414. }
  415. virtual bool finalizeOptions(IProperties *globals)
  416. {
  417. if (optWsdlAddress.isEmpty())
  418. optWsdlAddress.set("localhost");
  419. return Esdl2XSDCmd::finalizeOptions(globals);
  420. }
  421. virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &target, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
  422. {
  423. TimeSection ts("transforming via XSLT");
  424. cmdHelper.defHelper->toWSDL(objs, target, EsdlXslToWsdl, optInterfaceVersion, opts, NULL, optFlags);
  425. }
  426. virtual void loadTransform( StringBuffer &xsltpath, IProperties *params)
  427. {
  428. TimeSection ts("loading XSLT");
  429. cmdHelper.defHelper->loadTransform( xsltpath, params, EsdlXslToWsdl );
  430. }
  431. virtual void setTransformParams(IProperties *params )
  432. {
  433. cmdHelper.defHelper->setTransformParams(EsdlXslToWsdl, params);
  434. }
  435. virtual int processCMD()
  436. {
  437. cmdHelper.loadDefinition(optSource, optService.get(), optInterfaceVersion, "", optTraceFlags());
  438. createOptionals();
  439. Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService.get(), optMethod.get(), ESDLOPTLIST_DELIMITER, optInterfaceVersion, opts.get(), optFlags );
  440. if( optRawOutput )
  441. {
  442. outputRaw(*structs);
  443. }
  444. if( !optXsltPath.isEmpty() )
  445. {
  446. createParams();
  447. loadTransform( fullxsltpath, params);
  448. for( unsigned i=0; i < optXformTimes; i++ )
  449. {
  450. doTransform( *structs, outputBuffer, optInterfaceVersion, opts.get(), NULL, optFlags );
  451. }
  452. outputToFile();
  453. printf( "%s\n", outputBuffer.str() );
  454. }
  455. else
  456. {
  457. throw( MakeStringException(0, "Path to /xslt/esxdl2xsd.xslt is empty, cannot perform transform.") );
  458. }
  459. return 0;
  460. }
  461. virtual void usage()
  462. {
  463. puts("Usage:");
  464. puts("esdl wsdl sourcePath serviceName [options]\n\n" );
  465. puts("sourcePath - Absolute path to the ESDL definition file" );
  466. puts(" which contains ESDL Service definition." );
  467. puts("serviceName - Name of ESDL Service defined in the given definition file.\n" );
  468. printOptions();
  469. puts(" --wsdladdress Defines the output WSDL's location address\n");
  470. EsdlConvertCmd::usage();
  471. }
  472. virtual void createParams()
  473. {
  474. params.set(createProperties());
  475. generateNamespace(tns);
  476. // All params are treated as expressions, so any strings must be quoted
  477. // 1/0 are not equivalent to true/false, as 0 evaluates to true
  478. setXpathQuotedParam(params, "tnsParam", tns.str());
  479. setXpathQuotedParam(params, "optional", optOptional.str());
  480. if( optAllAnnot )
  481. {
  482. params->setProp( "all_annot_Param", "true()" );
  483. }
  484. if( optNoAnnot )
  485. {
  486. params->setProp( "no_annot_Param", "true()" );
  487. }
  488. params->setProp( "create_wsdl", "true()" );
  489. setXpathQuotedParam(params, "location", optWsdlAddress.str());
  490. if( optNoExceptionsInline )
  491. {
  492. params->setProp( "no_exceptions_inline", "true()" );
  493. }
  494. }
  495. public:
  496. StringAttr optWsdlAddress;
  497. };
  498. #define XSLT_ESDL2JAVABASE "esdl2java_srvbase.xslt"
  499. #define XSLT_ESDL2JAVADUMMY "esdl2java_srvdummy.xslt"
  500. class Esdl2JavaCmd : public EsdlHelperConvertCmd
  501. {
  502. public:
  503. Esdl2JavaCmd() : optFlags(0)
  504. {}
  505. virtual bool parseCommandLineOptions(ArgvIterator &iter)
  506. {
  507. if (iter.done())
  508. {
  509. usage();
  510. return false;
  511. }
  512. //First two parameters' order is fixed.
  513. for (int par = 0; par < 2 && !iter.done(); par++)
  514. {
  515. const char *arg = iter.query();
  516. if (*arg != '-')
  517. {
  518. if (optSource.isEmpty())
  519. optSource.set(arg);
  520. else if (optService.isEmpty())
  521. optService.set(arg);
  522. else
  523. {
  524. fprintf(stderr, "\nunrecognized argument detected before required parameters: %s\n", arg);
  525. usage();
  526. return false;
  527. }
  528. }
  529. else
  530. {
  531. fprintf(stderr, "\noption detected before required parameters: %s\n", arg);
  532. usage();
  533. return false;
  534. }
  535. iter.next();
  536. }
  537. for (; !iter.done(); iter.next())
  538. {
  539. if (parseCommandLineOption(iter))
  540. continue;
  541. if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
  542. return false;
  543. }
  544. return true;
  545. }
  546. virtual bool parseCommandLineOption(ArgvIterator &iter)
  547. {
  548. if (iter.matchOption(optService, ESDLOPT_SERVICE))
  549. return true;
  550. if (iter.matchOption(optMethod, ESDLOPT_METHOD))
  551. return true;
  552. if (iter.matchOption(optXsltPath, ESDLOPT_XSLT_PATH))
  553. return true;
  554. if (iter.matchOption(optPreprocessOutputDir, ESDLOPT_PREPROCESS_OUT))
  555. return true;
  556. if (EsdlConvertCmd::parseCommandLineOption(iter))
  557. return true;
  558. return false;
  559. }
  560. esdlCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
  561. {
  562. return EsdlConvertCmd::matchCommandLineOption(iter, true);
  563. }
  564. virtual bool finalizeOptions(IProperties *globals)
  565. {
  566. extractEsdlCmdOption(optIncludePath, globals, ESDLOPT_INCLUDE_PATH_ENV, ESDLOPT_INCLUDE_PATH_INI, NULL, NULL);
  567. if (optSource.isEmpty())
  568. {
  569. usage();
  570. throw( MakeStringException(0, "\nError: Source file parameter required\n"));
  571. }
  572. if( optService.isEmpty() )
  573. {
  574. usage();
  575. throw( MakeStringException(0, "A service name must be provided") );
  576. }
  577. if (!optXsltPath.length())
  578. {
  579. StringBuffer binXsltPath;
  580. getComponentFilesRelPathFromBin(binXsltPath);
  581. binXsltPath.append("/xslt/");
  582. StringBuffer temp;
  583. if (checkFileExists(temp.append(binXsltPath).append(XSLT_ESDL2JAVABASE)))
  584. optXsltPath.set(binXsltPath);
  585. else
  586. optXsltPath.set(temp.set(hpccBuildInfo.componentDir).append("/xslt/"));
  587. }
  588. cmdHelper.verbose = optVerbose;
  589. return true;
  590. }
  591. virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &out, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
  592. {
  593. }
  594. virtual void loadTransform( StringBuffer &xsltpath, IProperties *params )
  595. {
  596. }
  597. virtual void setTransformParams(IProperties *params )
  598. {
  599. }
  600. virtual int processCMD()
  601. {
  602. cmdHelper.loadDefinition(optSource, optService, 0, optIncludePath, optTraceFlags());
  603. Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService, optMethod, ESDLOPTLIST_DELIMITER, 0, NULL, optFlags );
  604. if(!optPreprocessOutputDir.isEmpty())
  605. {
  606. outputRaw(*structs);
  607. }
  608. StringBuffer xsltpathServiceBase(optXsltPath);
  609. xsltpathServiceBase.append(XSLT_ESDL2JAVABASE);
  610. cmdHelper.defHelper->loadTransform( xsltpathServiceBase, NULL, EsdlXslToJavaServiceBase);
  611. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToJavaServiceBase, NULL, optFlags );
  612. VStringBuffer javaFileNameBase("%sServiceBase.java", optService.get());
  613. saveAsFile(".", javaFileNameBase, outputBuffer.str(), NULL);
  614. StringBuffer xsltpathServiceDummy(optXsltPath);
  615. xsltpathServiceDummy.append(XSLT_ESDL2JAVADUMMY);
  616. cmdHelper.defHelper->loadTransform( xsltpathServiceDummy, NULL, EsdlXslToJavaServiceDummy);
  617. cmdHelper.defHelper->toMicroService( *structs, outputBuffer.clear(), EsdlXslToJavaServiceDummy, NULL, optFlags );
  618. VStringBuffer javaFileNameDummy("%sServiceDummy.java", optService.get());
  619. saveAsFile(".", javaFileNameDummy, outputBuffer.str(), NULL);
  620. return 0;
  621. }
  622. void printOptions()
  623. {
  624. puts("Options:");
  625. puts(" --method <meth name>[;<meth name>]* Constrain to list of specific method(s)" );
  626. puts(" --xslt <xslt file path> Path to xslt files used to transform EsdlDef to Java code" );
  627. puts(" --preprocess-output <raw output directory> : Output pre-processed xml file to specified directory before applying XSLT transform" );
  628. puts(" --show-inheritance Turns off the collapse feature. Collapsing optimizes the XML output to strip out structures" );
  629. puts(" only used for inheritance, and collapses their elements into their child. That simplifies the" );
  630. puts(" stylesheet. By default this option is on.");
  631. puts(ESDLOPT_INCLUDE_PATH_USAGE);
  632. }
  633. virtual void usage()
  634. {
  635. puts("Usage:");
  636. puts("esdl java sourcePath serviceName [options]\n" );
  637. puts("\nsourcePath - Absolute path to the EXSDL Definition file ( XML generated from ECM )" );
  638. puts(" which contains ESDL Service definition.\n" );
  639. puts("serviceName - Name of ESDL Service defined in the given EXSDL file.\n" );
  640. printOptions();
  641. EsdlConvertCmd::usage();
  642. }
  643. virtual void outputRaw( IEsdlDefObjectIterator& obj)
  644. {
  645. if (optPreprocessOutputDir.isEmpty())
  646. return;
  647. StringBuffer xml;
  648. xml.appendf( "<esxdl name='%s'>", optService.get());
  649. cmdHelper.defHelper->toXML( obj, xml, 0, NULL, optFlags );
  650. xml.append("</esxdl>");
  651. saveAsFile(optPreprocessOutputDir, NULL, xml, NULL );
  652. }
  653. void saveAsFile(const char * dir, const char *name, const char *text, const char *ext="")
  654. {
  655. StringBuffer path(dir);
  656. if (name && *name)
  657. {
  658. if (*name!=PATHSEPCHAR)
  659. addPathSepChar(path);
  660. path.append(name);
  661. }
  662. if( ext && *ext )
  663. path.append(ext);
  664. Owned<IFile> file = createIFile(path);
  665. Owned<IFileIO> io;
  666. io.setown(file->open(IFOcreate));
  667. DBGLOG("Writing java to file %s", file->queryFilename());
  668. if (io.get())
  669. io->write(0, strlen(text), text);
  670. else
  671. DBGLOG("File %s can't be created", file->queryFilename());
  672. }
  673. void setFlag( unsigned f ) { optFlags |= f; }
  674. void unsetFlag( unsigned f ) { optFlags &= ~f; }
  675. public:
  676. StringAttr optService;
  677. StringAttr optXsltPath;
  678. StringAttr optMethod;
  679. StringAttr optPreprocessOutputDir;
  680. unsigned optFlags;
  681. protected:
  682. StringBuffer outputBuffer;
  683. Owned<IProperties> params;
  684. };
  685. #define XSLT_ESDL2CPPBASEHPP "esdl2cpp_srvbasehpp.xslt"
  686. #define XSLT_ESDL2CPPBASECPP "esdl2cpp_srvbasecpp.xslt"
  687. #define XSLT_ESDL2CPPSRVHPP "esdl2cpp_srvhpp.xslt"
  688. #define XSLT_ESDL2CPPSRVCPP "esdl2cpp_srvcpp.xslt"
  689. #define XSLT_ESDL2CPPCMAKE "esdl2cpp_cmake.xslt"
  690. #define XSLT_ESDL2CPPTYPES "esdl2cpp_types.xslt"
  691. class Esdl2CppCmd : public EsdlHelperConvertCmd
  692. {
  693. public:
  694. Esdl2CppCmd() : optFlags(0)
  695. {}
  696. virtual bool parseCommandLineOptions(ArgvIterator &iter)
  697. {
  698. if (iter.done())
  699. {
  700. usage();
  701. return false;
  702. }
  703. //First two parameters' order is fixed.
  704. for (int par = 0; par < 2 && !iter.done(); par++)
  705. {
  706. const char *arg = iter.query();
  707. if (*arg != '-')
  708. {
  709. if (optSource.isEmpty())
  710. optSource.set(arg);
  711. else if (optService.isEmpty())
  712. optService.set(arg);
  713. else
  714. {
  715. fprintf(stderr, "\nunrecognized argument detected before required parameters: %s\n", arg);
  716. usage();
  717. return false;
  718. }
  719. }
  720. else
  721. {
  722. fprintf(stderr, "\noption detected before required parameters: %s\n", arg);
  723. usage();
  724. return false;
  725. }
  726. iter.next();
  727. }
  728. for (; !iter.done(); iter.next())
  729. {
  730. if (parseCommandLineOption(iter))
  731. continue;
  732. if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
  733. return false;
  734. }
  735. return true;
  736. }
  737. virtual bool parseCommandLineOption(ArgvIterator &iter)
  738. {
  739. if (iter.matchOption(optService, ESDLOPT_SERVICE))
  740. return true;
  741. if (iter.matchOption(optMethod, ESDLOPT_METHOD))
  742. return true;
  743. if (iter.matchOption(optXsltPath, ESDLOPT_XSLT_PATH))
  744. return true;
  745. if (iter.matchOption(optOutDirPath, ESDL_CONVERT_OUTDIR))
  746. return true;
  747. if (iter.matchOption(optPreprocessOutputDir, ESDLOPT_PREPROCESS_OUT))
  748. return true;
  749. if (EsdlConvertCmd::parseCommandLineOption(iter))
  750. return true;
  751. return false;
  752. }
  753. esdlCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
  754. {
  755. return EsdlConvertCmd::matchCommandLineOption(iter, true);
  756. }
  757. virtual bool finalizeOptions(IProperties *globals)
  758. {
  759. extractEsdlCmdOption(optIncludePath, globals, ESDLOPT_INCLUDE_PATH_ENV, ESDLOPT_INCLUDE_PATH_INI, NULL, NULL);
  760. if (optSource.isEmpty())
  761. {
  762. usage();
  763. throw( MakeStringException(0, "\nError: Source file parameter required\n"));
  764. }
  765. if( optService.isEmpty() )
  766. {
  767. usage();
  768. throw( MakeStringException(0, "A service name must be provided") );
  769. }
  770. if (!optXsltPath.length())
  771. {
  772. StringBuffer binXsltPath;
  773. getComponentFilesRelPathFromBin(binXsltPath);
  774. binXsltPath.append("/xslt/");
  775. StringBuffer temp;
  776. if (checkFileExists(temp.append(binXsltPath).append(XSLT_ESDL2CPPBASEHPP)))
  777. optXsltPath.set(binXsltPath);
  778. else
  779. optXsltPath.set(temp.set(hpccBuildInfo.componentDir).append("/xslt/"));
  780. }
  781. cmdHelper.verbose = optVerbose;
  782. return true;
  783. }
  784. virtual void doTransform(IEsdlDefObjectIterator& objs, StringBuffer &out, double version=0, IProperties *opts=NULL, const char *ns=NULL, unsigned flags=0 )
  785. {
  786. }
  787. virtual void loadTransform( StringBuffer &xsltpath, IProperties *params )
  788. {
  789. }
  790. virtual void setTransformParams(IProperties *params )
  791. {
  792. }
  793. virtual int processCMD()
  794. {
  795. cmdHelper.loadDefinition(optSource, optService, 0, optIncludePath, optTraceFlags());
  796. Owned<IEsdlDefObjectIterator> structs = cmdHelper.esdlDef->getDependencies( optService, optMethod, ESDLOPTLIST_DELIMITER, 0, NULL, optFlags );
  797. if(!optPreprocessOutputDir.isEmpty())
  798. {
  799. outputRaw(*structs);
  800. }
  801. StringBuffer outdir;
  802. if (optOutDirPath.length() > 0)
  803. outdir.append(optOutDirPath);
  804. else
  805. outdir.append(".");
  806. StringBuffer sourcedir(outdir);
  807. sourcedir.append(PATHSEPCHAR).append("source");
  808. StringBuffer builddir(outdir);
  809. builddir.append(PATHSEPCHAR).append("build");
  810. recursiveCreateDirectory(sourcedir.str());
  811. recursiveCreateDirectory(builddir.str());
  812. VStringBuffer hppFileNameBase("%sServiceBase.hpp", optService.get());
  813. StringBuffer xsltpath(optXsltPath);
  814. xsltpath.append(XSLT_ESDL2CPPBASEHPP);
  815. StringBuffer filefullpath;
  816. filefullpath.append(sourcedir).append(PATHSEPCHAR).append(hppFileNameBase);
  817. if (checkFileExists(filefullpath.str()))
  818. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  819. else
  820. {
  821. cmdHelper.defHelper->loadTransform( xsltpath, NULL, EsdlXslToCppServiceBaseHpp);
  822. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppServiceBaseHpp, NULL, optFlags );
  823. saveAsFile(sourcedir, hppFileNameBase, outputBuffer.str(), NULL);
  824. }
  825. VStringBuffer cppFileNameBase("%sServiceBase.cpp", optService.get());
  826. outputBuffer.clear();
  827. xsltpath.clear().append(optXsltPath);
  828. xsltpath.append(XSLT_ESDL2CPPBASECPP);
  829. filefullpath.clear().append(sourcedir).append(PATHSEPCHAR).append(cppFileNameBase);
  830. if (checkFileExists(filefullpath.str()))
  831. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  832. else
  833. {
  834. cmdHelper.defHelper->loadTransform( xsltpath, NULL, EsdlXslToCppServiceBaseCpp);
  835. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppServiceBaseCpp, NULL, optFlags );
  836. saveAsFile(sourcedir.str(), cppFileNameBase, outputBuffer.str(), NULL);
  837. }
  838. VStringBuffer srvHppFileNameBase("%sService.hpp", optService.get());
  839. outputBuffer.clear();
  840. xsltpath.clear().append(optXsltPath);
  841. xsltpath.append(XSLT_ESDL2CPPSRVHPP);
  842. filefullpath.clear().append(sourcedir).append(PATHSEPCHAR).append(srvHppFileNameBase);
  843. if (checkFileExists(filefullpath.str()))
  844. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  845. else
  846. {
  847. cmdHelper.defHelper->loadTransform( xsltpath, NULL, EsdlXslToCppServiceHpp);
  848. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppServiceHpp, NULL, optFlags );
  849. saveAsFile(sourcedir.str(), srvHppFileNameBase, outputBuffer.str(), NULL);
  850. }
  851. VStringBuffer srvCppFileNameBase("%sService.cpp", optService.get());
  852. outputBuffer.clear();
  853. xsltpath.clear().append(optXsltPath);
  854. xsltpath.append(XSLT_ESDL2CPPSRVCPP);
  855. filefullpath.clear().append(sourcedir).append(PATHSEPCHAR).append(srvCppFileNameBase);
  856. if (checkFileExists(filefullpath.str()))
  857. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  858. else
  859. {
  860. cmdHelper.defHelper->loadTransform( xsltpath, NULL, EsdlXslToCppServiceCpp);
  861. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppServiceCpp, NULL, optFlags );
  862. saveAsFile(sourcedir.str(), srvCppFileNameBase, outputBuffer.str(), NULL);
  863. }
  864. outputBuffer.clear();
  865. xsltpath.clear().append(optXsltPath);
  866. xsltpath.append(XSLT_ESDL2CPPCMAKE);
  867. filefullpath.clear().append(sourcedir).append(PATHSEPCHAR).append("CMakeLists.txt");
  868. if (checkFileExists(filefullpath.str()))
  869. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  870. else
  871. {
  872. Owned<IProperties> params = createProperties();
  873. setXpathQuotedParam(params, "installdir", hpccBuildInfo.installDir);
  874. cmdHelper.defHelper->loadTransform( xsltpath, params.get(), EsdlXslToCppCMake);
  875. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppCMake, NULL, optFlags );
  876. saveAsFile(sourcedir.str(), "CMakeLists.txt", outputBuffer.str(), NULL);
  877. }
  878. outputBuffer.clear();
  879. xsltpath.clear().append(optXsltPath);
  880. xsltpath.append(XSLT_ESDL2CPPTYPES);
  881. filefullpath.clear().append(sourcedir).append(PATHSEPCHAR).append("primitivetypes.hpp");
  882. if (checkFileExists(filefullpath.str()))
  883. DBGLOG("ATTENTION: File %s already exists, won't generate again", filefullpath.str());
  884. else
  885. {
  886. cmdHelper.defHelper->loadTransform( xsltpath, NULL, EsdlXslToCppTypes);
  887. cmdHelper.defHelper->toMicroService( *structs, outputBuffer, EsdlXslToCppTypes, NULL, optFlags );
  888. saveAsFile(sourcedir.str(), "primitivetypes.hpp", outputBuffer.str(), NULL);
  889. }
  890. return 0;
  891. }
  892. void printOptions()
  893. {
  894. puts("Options:");
  895. puts(" --method <meth name>[;<meth name>]* Constrain to list of specific method(s)" );
  896. puts(" --xslt <xslt file path> Path to xslt files used to transform EsdlDef to c++ code" );
  897. puts(" --preprocess-output <raw output directory> : Output pre-processed xml file to specified directory before applying XSLT transform" );
  898. puts(" --show-inheritance Turns off the collapse feature. Collapsing optimizes the XML output to strip out structures" );
  899. puts(" only used for inheritance, and collapses their elements into their child. That simplifies the" );
  900. puts(" stylesheet. By default this option is on.");
  901. puts(ESDLOPT_INCLUDE_PATH_USAGE);
  902. }
  903. virtual void usage()
  904. {
  905. puts("Usage:");
  906. puts("esdl cpp sourcePath serviceName [options]\n" );
  907. puts("\nsourcePath - Absolute path to the EXSDL Definition file ( XML generated from ECM )" );
  908. puts(" which contains ESDL Service definition.\n" );
  909. puts("serviceName - Name of ESDL Service defined in the given EXSDL file.\n" );
  910. printOptions();
  911. EsdlConvertCmd::usage();
  912. }
  913. virtual void outputRaw( IEsdlDefObjectIterator& obj)
  914. {
  915. if (optPreprocessOutputDir.isEmpty())
  916. return;
  917. StringBuffer xml;
  918. xml.appendf( "<esxdl name='%s'>", optService.get());
  919. cmdHelper.defHelper->toXML( obj, xml, 0, NULL, optFlags );
  920. xml.append("</esxdl>");
  921. saveAsFile(optPreprocessOutputDir, NULL, xml, NULL );
  922. }
  923. void saveAsFile(const char * dir, const char *name, const char *text, const char *ext="")
  924. {
  925. StringBuffer path(dir);
  926. if (name && *name)
  927. {
  928. if (*name!=PATHSEPCHAR)
  929. addPathSepChar(path);
  930. path.append(name);
  931. }
  932. if( ext && *ext )
  933. path.append(ext);
  934. Owned<IFile> file = createIFile(path);
  935. Owned<IFileIO> io;
  936. io.setown(file->open(IFOcreate));
  937. DBGLOG("Writing c++ to file %s", file->queryFilename());
  938. if (io.get())
  939. io->write(0, strlen(text), text);
  940. else
  941. DBGLOG("File %s can't be created", file->queryFilename());
  942. }
  943. void setFlag( unsigned f ) { optFlags |= f; }
  944. void unsetFlag( unsigned f ) { optFlags &= ~f; }
  945. public:
  946. StringAttr optService;
  947. StringAttr optXsltPath;
  948. StringAttr optMethod;
  949. StringAttr optOutDirPath;
  950. StringAttr optPreprocessOutputDir;
  951. unsigned optFlags;
  952. protected:
  953. StringBuffer outputBuffer;
  954. Owned<IProperties> params;
  955. };
  956. //=========================================================================================
  957. IEsdlCommand *createCoreEsdlCommand(const char *cmdname)
  958. {
  959. if (!cmdname || !*cmdname)
  960. return NULL;
  961. if (strieq(cmdname, "XSD"))
  962. return new Esdl2XSDCmd();
  963. if (strieq(cmdname, "ECL"))
  964. return new Esdl2EclCmd();
  965. if (strieq(cmdname, "JAVA"))
  966. return new Esdl2JavaCmd();
  967. if (strieq(cmdname, "CPP"))
  968. return new Esdl2CppCmd();
  969. if (strieq(cmdname, "WSDL"))
  970. return new Esdl2WSDLCmd();
  971. if (strieq(cmdname, "PUBLISH"))
  972. return new EsdlPublishCmd();
  973. if (strieq(cmdname, "DELETE"))
  974. return new EsdlDeleteESDLDefCmd();
  975. if (strieq(cmdname, "BIND-SERVICE"))
  976. return new EsdlBindServiceCmd();
  977. if (strieq(cmdname, "BIND-METHOD"))
  978. return new EsdlBindMethodCmd();
  979. if (strieq(cmdname, "UNBIND-METHOD"))
  980. return new EsdlUnBindMethodCmd();
  981. if (strieq(cmdname, "GET-BINDING"))
  982. return new EsdlGetBindingCmd();
  983. if (strieq(cmdname, "GET-DEFINITION"))
  984. return new EsdlGetDefinitionCmd();
  985. if (strieq(cmdname, "UNBIND-SERVICE"))
  986. return new EsdlUnBindServiceCmd();
  987. if (strieq(cmdname, "LIST-DEFINITIONS"))
  988. return new EsdlListESDLDefCmd();
  989. if (strieq(cmdname, "LIST-BINDINGS"))
  990. return new EsdlListESDLBindingsCmd();
  991. if (strieq(cmdname, "BIND-LOG-TRANSFORM"))
  992. return new EsdlBindLogTransformCmd();
  993. if (strieq(cmdname, "UNBIND-LOG-TRANSFORM"))
  994. return new EsdlUnBindLogTransformCmd();
  995. if (strieq(cmdname, "MONITOR"))
  996. return createEsdlMonitorCommand(cmdname);
  997. if (strieq(cmdname, "MONITOR-TEMPLATE"))
  998. return createEsdlMonitorCommand(cmdname);
  999. return NULL;
  1000. }