scheu 02/03/22 09:21:25 Modified: java/src/org/apache/axis/utils resources.properties java/src/org/apache/axis/wsdl WSDL2Java.java java/src/org/apache/axis/wsdl/fromJava Emitter.java java/src/org/apache/axis/wsdl/toJava Emitter.java JavaBeanWriter.java java/test/wsdl Wsdl2javaAntTask.java Wsdl2javaTestSuite.xml Log: Added the following options to WSDL2Java -F (-factory) <className> This option will use the indicated class as the JavaWriterFactory. -H (-helperGen) This option will cause separate Helper classes for the bean meta data (the default is to embed the data in the bean classes). Changed the comprehensive test case to use the -H option. Revision Changes Path 1.83 +3 -0 xml-axis/java/src/org/apache/axis/utils/resources.properties Index: resources.properties =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- resources.properties 21 Mar 2002 22:27:02 -0000 1.82 +++ resources.properties 22 Mar 2002 17:21:25 -0000 1.83 @@ -788,3 +788,6 @@ CantGetSerializer=unable to get serializer for class {0} noVector00={0}: {1} is not a vector + +optionFactory00=name of the JavaWriterFactory class for extending Java generation functions +optionHelper00=emits separate Helper classes for meta data 1.19 +44 -0 xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java Index: WSDL2Java.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- WSDL2Java.java 19 Mar 2002 17:52:09 -0000 1.18 +++ WSDL2Java.java 22 Mar 2002 17:21:25 -0000 1.19 @@ -104,6 +104,9 @@ protected static final int ALL_OPT = 'a'; protected static final int TYPEMAPPING_OPT = 'T'; protected static final int NETWORK_TIMEOUT_OPT = 'O'; + protected static final int FACTORY_CLASS_OPT = 'F'; + protected static final int HELPER_CLASS_OPT = 'H'; + // Scope constants public static final byte NO_EXPLICIT_SCOPE = 0x00; @@ -184,6 +187,14 @@ CLOptionDescriptor.ARGUMENT_REQUIRED, TYPEMAPPING_OPT, JavaUtils.getMessage("optionTypeMapping00")), + new CLOptionDescriptor("factory", + CLOptionDescriptor.ARGUMENT_REQUIRED, + FACTORY_CLASS_OPT, + JavaUtils.getMessage("optionFactory00")), + new CLOptionDescriptor("helperGen", + CLOptionDescriptor.ARGUMENT_DISALLOWED, + HELPER_CLASS_OPT, + JavaUtils.getMessage("optionHelper00")), new CLOptionDescriptor("timeout", CLOptionDescriptor.ARGUMENT_REQUIRED, NETWORK_TIMEOUT_OPT, @@ -284,6 +295,31 @@ return emitter.getDebug(); } // getDebug + + /** + * Indicate writer factory + * @param String class name + */ + public void factory(String value) { + emitter.setFactory(value); + } + + /** + * Indicate helper Generation s + * @param boolean value + */ + public void helperGen(boolean value) { + emitter.setHelperGeneration(value); + } + + /** + * Indicate helper Generation s + * @param boolean value + */ + public boolean getHelperGen() { + return emitter.getHelperGeneration(); + } + /** * Turn on/off verbose messages * @param boolean value @@ -504,6 +540,14 @@ case VERBOSE_OPT: wsdl2java.verbose(true); + break; + + case FACTORY_CLASS_OPT: + wsdl2java.factory(option.getArgument()); + break; + + case HELPER_CLASS_OPT: + wsdl2java.helperGen(true); break; case SKELETON_DEPLOY_OPT: 1.24 +2 -1 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java Index: Emitter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Emitter.java 13 Mar 2002 16:48:40 -0000 1.23 +++ Emitter.java 22 Mar 2002 17:21:25 -0000 1.24 @@ -1031,8 +1031,9 @@ */ public void setFactory(String className) { try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); factory = (Java2WSDLFactory) - Class.forName(className).newInstance(); + Class.forName(className, true,cl).newInstance(); } catch (Exception ex) { ex.printStackTrace(); 1.28 +31 -0 xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java Index: Emitter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Emitter.java 21 Mar 2002 22:27:02 -0000 1.27 +++ Emitter.java 22 Mar 2002 17:21:25 -0000 1.28 @@ -114,6 +114,7 @@ protected boolean bVerbose = false; protected boolean bGenerateImports = true; protected boolean bGenerateAll = false; + protected boolean bHelperGeneration = false; protected String outputDir = null; protected String packageName = null; protected byte scope = NO_EXPLICIT_SCOPE; @@ -133,6 +134,21 @@ this.writerFactory = writerFactory; } // ctor + /** + * Sets the <code>WriterFactory Class</code> to use + * @param className the name of the factory <code>Class</code> + */ + public void setFactory(String className) { + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + writerFactory = (WriterFactory) + Class.forName(className, true,cl).newInstance(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + public SymbolTable getSymbolTable() { return symbolTable;} public WriterFactory getWriterFactory() { return writerFactory;} /** @@ -299,6 +315,21 @@ */ public boolean getDeploySkeleton() { return bDeploySkeleton; + } + + /** + * Turn on/off Helper class generation + * @param boolean value + */ + public void setHelperGeneration(boolean value) { + bHelperGeneration = value; + } + + /** + * Indicate if we should be generating Helper classes + */ + public boolean getHelperGeneration() { + return bHelperGeneration; } /** 1.5 +7 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java Index: JavaBeanWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JavaBeanWriter.java 22 Mar 2002 05:19:39 -0000 1.4 +++ JavaBeanWriter.java 22 Mar 2002 17:21:25 -0000 1.5 @@ -243,7 +243,13 @@ writeEqualsMethod(); - helper.write(pw); + // Write the meta data into a Helper class or + // embed it in the bean class + if (emitter.getHelperGeneration()) { + helper.write(); // separate Helper Class + } else { + helper.write(pw); // embed in Bean Class + } pw.println("}"); pw.close(); } // writeFileBody 1.23 +18 -0 xml-axis/java/test/wsdl/Wsdl2javaAntTask.java Index: Wsdl2javaAntTask.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaAntTask.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Wsdl2javaAntTask.java 13 Mar 2002 05:18:06 -0000 1.22 +++ Wsdl2javaAntTask.java 22 Mar 2002 17:21:25 -0000 1.23 @@ -81,6 +81,8 @@ private boolean testCase = false; private boolean noImports = false; private boolean all = false; + private boolean helperGen = false; + private String factory = null; private HashMap namespaceMap = new HashMap(); private String output = "." ; private String deployScope = ""; @@ -95,6 +97,8 @@ log("\tverbose:" + verbose, Project.MSG_VERBOSE); log("\tserver-side:" + server, Project.MSG_VERBOSE); log("\tskeletonDeploy:" + skeletonDeploy, Project.MSG_VERBOSE); + log("\thelperGen:" + helperGen, Project.MSG_VERBOSE); + log("\tfactory:" + factory, Project.MSG_VERBOSE); log("\ttestCase:" + testCase, Project.MSG_VERBOSE); log("\tnoImports:" + noImports, Project.MSG_VERBOSE); log("\tNStoPkg:" + namespaceMap, Project.MSG_VERBOSE); @@ -127,6 +131,10 @@ emitter.setNamespaceMap(namespaceMap); } emitter.generateTestCase(testCase); + emitter.helperGen(helperGen); + if (factory != null) { + emitter.factory(factory); + } emitter.generateImports(!noImports); emitter.generateAll(all); emitter.setOutputDir(output); @@ -175,6 +183,16 @@ // The setter for the "testcase" attribute public void setTestCase(String parameter) { this.testCase = Project.toBoolean(parameter); + } + + // The setter for the "helperGen" attribute + public void setHelperGen(String parameter) { + this.helperGen = Project.toBoolean(parameter); + } + + // The setter for the "factory" attribute + public void setFactory(String parameter) { + this.factory = parameter; } // The setter for the "noimports" attribute 1.90 +1 -0 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml Index: Wsdl2javaTestSuite.xml =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- Wsdl2javaTestSuite.xml 21 Mar 2002 14:30:26 -0000 1.89 +++ Wsdl2javaTestSuite.xml 22 Mar 2002 17:21:25 -0000 1.90 @@ -706,6 +706,7 @@ <wsdl2java url="test/wsdl/types/ComprehensiveTypes.wsdl" output="build/work" serverSide="yes" + helperGen="yes" testcase="yes"> </wsdl2java>