From: Teiniker E. <tei...@us...> - 2007-04-13 10:37:17
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/ant In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11358/src/ccmtools/ant Modified Files: IncludePath.java GeneratorType.java IdljTask.java BindingType.java CcmtoolsTask.java Log Message: Added convenients generator ids for the ccmtools ant task. Added source code documentation. Index: IdljTask.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/ant/IdljTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IdljTask.java 12 Apr 2007 15:08:28 -0000 1.2 --- IdljTask.java 13 Apr 2007 10:37:08 -0000 1.3 *************** *** 1,3 **** ! /* CCM Tools : ccmtools ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net --- 1,3 ---- ! /* CCM Tools : ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net *************** *** 35,43 **** import org.apache.tools.ant.types.FileSet; public class IdljTask extends Task { /** ! * Handle attribute keep * If a file to be generated already exists, do not overwrite it. * By default it is overwritten. --- 35,67 ---- import org.apache.tools.ant.types.FileSet; + + /** + * This <idlj> ant task is used to execute java's IDL compiler + * from an ant build file. + * + * TODO: there are some idlj options that have not been implemented yet + * as ant attributes or nested elements: + * + * -d <symbol> + * This is equivalent to the following line in an IDL file: + * #define <symbol> + * + * -pkgPrefix <t> <prefix> + * When the type or module name <t> is encountered at file scope, + * begin the Java package name for all files generated for <t> + * with <prefix>. + * + * -pkgTranslate <t> <pkg> + * When the type or module name <t> in encountered, replace + * it with <pkg> in the generated java package. Note that + * pkgPrefix changes are made first. <t> must match the + * full package name exactly. Also, <t> must not be + * org, org.omg, or any subpackage of org.omg. + */ public class IdljTask extends Task { /** ! * Attribute: keep * If a file to be generated already exists, do not overwrite it. * By default it is overwritten. *************** *** 51,55 **** /** ! * Handle attribute emitAll * Emit all types, including those found in #included files. */ --- 75,79 ---- /** ! * Attribute: emitAll * Emit all types, including those found in #included files. */ *************** *** 62,66 **** /** ! * Handle attribute noWarn * Suppress warnings. */ --- 86,90 ---- /** ! * Attribute: noWarn * Suppress warnings. */ *************** *** 73,78 **** /** ! * Handle attribute oldImplBase ! * */ private boolean oldImplBase = false; --- 97,102 ---- /** ! * Attribute: oldImplBase ! * Generate skeletons compatible with old (pre-1.4) JDK ORBs. */ private boolean oldImplBase = false; *************** *** 84,89 **** /** ! * Handle attribute verbose ! * */ private boolean verbose = false; --- 108,113 ---- /** ! * Attribute: verbose ! * Verbose mode. */ private boolean verbose = false; *************** *** 95,100 **** /** ! * Handle attribute skeletonName ! * */ private String skeletonName; --- 119,127 ---- /** ! * Attribute: skeletonName="<xxx%yyy>" ! * Name the skeleton according to the pattern. ! * The defaults are: ! * %POA for the POA base class (-fserver or -fall) ! * _%ImplBase for the oldImplBase base class */ private String skeletonName; *************** *** 106,111 **** /** ! * Handle attribute tieName ! * */ private String tieName; --- 133,141 ---- /** ! * Attribute: tieName="<xxx%yyy>" ! * Name the tie according to the pattern. ! * The defaults are: ! * %POATie for the POA tie (-fserverTie or -fallTie) ! * %_Tie for the oldImplBase tie */ private String tieName; *************** *** 117,124 **** /** ! * Handle attribute binding ! * */ ! private String binding = "fall"; public void setBinding(BindingType binding) { --- 147,157 ---- /** ! * Attribute: binding="f<side>" ! * Define what bindings to emit. ! * <side> is one of client, server, all, serverTIE, allTIE. ! * serverTIE and allTIE cause delegate model skeletons to be emitted. ! * If this flag is not used, -fclient is assumed. */ ! private String binding = "fclient"; public void setBinding(BindingType binding) { *************** *** 128,133 **** /** ! * Handle attribute destdir ! * */ private File destDir = new File("./"); --- 161,166 ---- /** ! * Attribute: destdir="<dir>" ! * Use <dir> for the output directory instead of the current directory. */ private File destDir = new File("./"); *************** *** 139,144 **** /** ! * Handle nested <include> elements ! * */ private List<String> includePaths = new ArrayList<String>(); --- 172,178 ---- /** ! * Nested element: <include> ! * By default, the current directory is scanned for included files. ! * This option adds another directory. */ private List<String> includePaths = new ArrayList<String>(); *************** *** 153,158 **** /** ! * Handle file sets ! * */ private List<FileSet> filesets = new ArrayList<FileSet>(); --- 187,192 ---- /** ! * Nested element: fileset ! * Specifies a set of input files for the IDL generator. */ private List<FileSet> filesets = new ArrayList<FileSet>(); *************** *** 164,167 **** --- 198,207 ---- + /** + * Execute the <ccmtools> task based on the given attributes and + * nested elements. + * To run the IDL generator, a helper method is called for every + * single input file. + */ public void execute() { *************** *** 186,189 **** --- 226,233 ---- + /** + * Helper method to execute java's idlj script. + * Note that idlj must be reachable from the environment's PATH variable. + */ public void runIdlCompiler(File idlFile) { *************** *** 252,255 **** --- 296,303 ---- + /** + * Helper class to log the given attributes and nested elements of + * the <idlj> task (shown in ant's verbose mode). + */ public void logTask() { Index: CcmtoolsTask.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/ant/CcmtoolsTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CcmtoolsTask.java 12 Apr 2007 15:08:28 -0000 1.2 --- CcmtoolsTask.java 13 Apr 2007 10:37:09 -0000 1.3 *************** *** 1,3 **** ! /* CCM Tools : ccmtools ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net --- 1,3 ---- ! /* CCM Tools : ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net *************** *** 31,40 **** import org.apache.tools.ant.types.FileSet; public class CcmtoolsTask extends Task { /** ! * Handle attribute generator ! * */ private String generator; --- 31,44 ---- import org.apache.tools.ant.types.FileSet; + /** + * This <ccmtools> ant task is used to execute different ccmtools generators + * from an ant build file. + */ public class CcmtoolsTask extends Task { /** ! * attribute: generator ! * Defines the ccmtools generator type (see GeneratorType) */ private String generator; *************** *** 43,51 **** this.generator=generator.getValue(); } ! /** ! * Handle attribute destdir ! * */ private File destDir = new File("./"); --- 47,67 ---- this.generator=generator.getValue(); } ! /** ! * Attribute: validate ! * Forces the execution of ccmtools' model validator which ensures ! * that a given IDL file conforms to the supported ccmtools metamodel. ! */ ! private boolean validate = false; ! public void setValidate(boolean validate) ! { ! this.validate=validate; ! } ! ! ! /** ! * Attribute: destdir ! * Defines the generator's output directory. */ private File destDir = new File("./"); *************** *** 57,62 **** /** ! * Handle nested includepath elements ! * */ private List<String> includePaths; --- 73,79 ---- /** ! * Nested element: <include> ! * Contains a path attribute to specify an include path for the given ! * generator (see IncludePath). */ private List<String> includePaths; *************** *** 71,76 **** /** ! * Handle file sets ! * */ private List<FileSet> filesets = new ArrayList<FileSet>(); --- 88,93 ---- /** ! * Nested element: <fileset> ! * Specifies a set of input files for the given generator. */ private List<FileSet> filesets = new ArrayList<FileSet>(); *************** *** 80,84 **** } ! public void execute() { --- 97,107 ---- } ! ! /** ! * Execute the <ccmtools> task based on the given attributes and ! * nested elements. ! * To run the ccmtools generators, their static main methods are called ! * with a particular args array. ! */ public void execute() { *************** *** 105,109 **** if(generator.startsWith("model")) { ! executeModelTools(); } else if(generator.startsWith("idl")) --- 128,132 ---- if(generator.startsWith("model")) { ! executeModelTools(generator); } else if(generator.startsWith("idl")) *************** *** 117,130 **** } ! ! protected void executeModelTools() { StringBuilder cmd = new StringBuilder(); ! if(generator.equals("model.validator")) { cmd.append("-validator"); } ! else if(generator.equals("model.parser")) { cmd.append("-parser"); --- 140,156 ---- } ! ! /** ! * Helper method to execute the ccmtools.parser.idl.metamodel.Main class. ! */ ! protected void executeModelTools(String type) { StringBuilder cmd = new StringBuilder(); ! if(type.equals("model.validator")) { cmd.append("-validator"); } ! else if(type.equals("model.parser")) { cmd.append("-parser"); *************** *** 148,159 **** } ! log("command line = " + cmd.toString(), Project.MSG_VERBOSE); String[] args = cmd.toString().split(" "); ccmtools.parser.idl.metamodel.Main.main(args); } ! protected void executeIdlGenerator() { StringBuilder cmd = new StringBuilder(); --- 174,193 ---- } ! log(">> ccmmodel " + cmd.toString()); String[] args = cmd.toString().split(" "); ccmtools.parser.idl.metamodel.Main.main(args); } ! ! /** ! * Helper method to execute the ccmtools.generator.idl.Main class. ! */ protected void executeIdlGenerator() { + if(validate) + { + executeModelTools("model.validator"); + } + StringBuilder cmd = new StringBuilder(); *************** *** 190,194 **** } ! log("command line = " + cmd.toString(), Project.MSG_VERBOSE); String[] args = cmd.toString().split(" "); ccmtools.generator.idl.Main.main(args); --- 224,228 ---- } ! log(">> ccmidl " + cmd.toString()); String[] args = cmd.toString().split(" "); ccmtools.generator.idl.Main.main(args); *************** *** 196,216 **** protected void executeJavaGenerator() { StringBuilder cmd = new StringBuilder(); ! if(generator.equals("java.iface")) { cmd.append("-iface"); } ! else if(generator.equals("java.local")) { cmd.append("-local"); } ! else if(generator.equals("java.app")) { cmd.append("-app"); } ! else if(generator.equals("java.remote")) { cmd.append("-remote"); --- 230,262 ---- + /** + * Helper method to execute the ccmtools.generator.java.Main class. + */ protected void executeJavaGenerator() { + if(validate) + { + executeModelTools("model.validator"); + } + StringBuilder cmd = new StringBuilder(); ! if(generator.equals("java.local")) ! { ! cmd.append("-iface -local"); ! } ! else if(generator.equals("java.local.iface")) { cmd.append("-iface"); } ! else if(generator.equals("java.local.adapter")) { cmd.append("-local"); } ! else if(generator.equals("java.impl")) { cmd.append("-app"); } ! else if(generator.equals("java.remote.adapter")) { cmd.append("-remote"); *************** *** 240,244 **** } ! log("command line = " + cmd.toString(), Project.MSG_VERBOSE); String[] args = cmd.toString().split(" "); ccmtools.generator.java.Main.main(args); --- 286,290 ---- } ! log(">> ccmjava " + cmd.toString()); String[] args = cmd.toString().split(" "); ccmtools.generator.java.Main.main(args); *************** *** 246,249 **** --- 292,299 ---- + /** + * Helper class to log the given attributes and nested elements of + * the <ccmtools> task (shown in ant's verbose mode). + */ public void logTask() { *************** *** 252,255 **** --- 302,306 ---- log("property ccmtools.home = " + home, Project.MSG_VERBOSE); log("attribute generator = " + generator, Project.MSG_VERBOSE); + log("attribute validate = " + validate, Project.MSG_VERBOSE); if(destDir != null) log("attribute destdir = " + destDir.getAbsolutePath(), Project.MSG_VERBOSE); Index: BindingType.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/ant/BindingType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BindingType.java 12 Apr 2007 15:08:28 -0000 1.2 --- BindingType.java 13 Apr 2007 10:37:09 -0000 1.3 *************** *** 1,3 **** ! /* CCM Tools : ccmtools ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net --- 1,3 ---- ! /* CCM Tools : ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net *************** *** 25,29 **** extends EnumeratedAttribute { ! public String[] getValues() { --- 25,32 ---- extends EnumeratedAttribute { ! /** ! * This class is used by the Ant framework to define the possible ! * values of the <idlj> task's binding attribute. ! */ public String[] getValues() { Index: IncludePath.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/ant/IncludePath.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IncludePath.java 12 Apr 2007 15:08:28 -0000 1.2 --- IncludePath.java 13 Apr 2007 10:37:08 -0000 1.3 *************** *** 1,3 **** ! /* CCM Tools : ccmtools ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net --- 1,3 ---- ! /* CCM Tools : ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net *************** *** 22,34 **** import org.apache.tools.ant.types.Path; public class IncludePath ! { ! ! public String[] getPaths() ! { ! return path.list(); ! } ! ! /** Handle path attribute */ private Path path; public void setPath(Path path) --- 22,36 ---- import org.apache.tools.ant.types.Path; + /** + * This class implements the nested <include> element of the <ccmtools> + * ant task. + */ public class IncludePath ! { ! /** ! * Attribute: path ! * Specifies a Path object which is used to define include paths for a ! * ccmtools generator call. ! */ private Path path; public void setPath(Path path) *************** *** 36,40 **** this.path = path; } ! public String toString() --- 38,50 ---- this.path = path; } ! ! /** ! * Getter method that returns all stored include paths as a string array. ! */ ! public String[] getPaths() ! { ! return path.list(); ! } ! public String toString() Index: GeneratorType.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/ant/GeneratorType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GeneratorType.java 12 Apr 2007 15:08:28 -0000 1.2 --- GeneratorType.java 13 Apr 2007 10:37:08 -0000 1.3 *************** *** 1,3 **** ! /* CCM Tools : ccmtools ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net --- 1,3 ---- ! /* CCM Tools : ant tasks * Egon Teiniker <ego...@fh...> * Copyright (C) 2002 - 2007 ccmtools.sourceforge.net *************** *** 22,29 **** import org.apache.tools.ant.types.EnumeratedAttribute; public class GeneratorType extends EnumeratedAttribute { - public String[] getValues() { --- 22,33 ---- import org.apache.tools.ant.types.EnumeratedAttribute; + /** + * This class is used by the Ant framework to define the possible + * values of the <ccmtools> task's generator attribute. + * Each value represents one or more ccmtools generator calls. + */ public class GeneratorType extends EnumeratedAttribute { public String[] getValues() { *************** *** 40,47 **** // ccmtools.generator.java ! "java.iface", ! "java.local", ! "java.app", ! "java.remote", "java.clientlib", --- 44,52 ---- // ccmtools.generator.java ! "java.local", // => "java.local.iface" + "java.local.adapter" ! "java.local.iface", ! "java.local.adapter", ! "java.impl", ! "java.remote.adapter", "java.clientlib", |