You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/06/13 14:54:29 UTC
svn commit: r413891 - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/
codegen/src/org/apache/axis2/wsdl/codegen/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codegen/extension/ ...
Author: ajith
Date: Tue Jun 13 05:54:28 2006
New Revision: 413891
URL: http://svn.apache.org/viewvc?rev=413891&view=rev
Log:
1. Added a new feature to allow the codegen to flatten files.
I. Changed the parameters to have the -f option
II. Changed the writers and emitters to pass the proper file location depending on the flag
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTConstants.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Tue Jun 13 05:54:28 2006
@@ -144,7 +144,10 @@
*/
private static void populateDefaultOptions(CompilerOptions options,CodeGenConfiguration configuration) {
//create the output directory
- File outputDir = new File(configuration.getOutputLocation(), "src");
+ File outputDir = configuration.isFlattenFiles()?
+ configuration.getOutputLocation():
+ new File(configuration.getOutputLocation(),"src");
+
if(!outputDir.exists()) {
outputDir.mkdirs();
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Tue Jun 13 05:54:28 2006
@@ -70,6 +70,18 @@
this.uri2PackageNameMap = uri2PackageNameMap;
}
+ /**
+ * Says whether to flatten the files or put them in specific folders
+ */
+ private boolean flattenFiles = false;
+
+ public boolean isFlattenFiles() {
+ return flattenFiles;
+ }
+
+ public void setFlattenFiles(boolean flattenFiles) {
+ this.flattenFiles = flattenFiles;
+ }
/**
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Tue Jun 13 05:54:28 2006
@@ -28,7 +28,6 @@
import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
import org.apache.axis2.wsdl.util.CommandLineOptionParser;
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
-import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.woden.wsdl20.xml.DescriptionElement;
@@ -118,7 +117,6 @@
} catch (WSDLException e) {
throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), e);
} catch (Exception e) {
- e.printStackTrace();
throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), e);
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Tue Jun 13 05:54:28 2006
@@ -31,10 +31,10 @@
public static void loadConfig(CodeGenConfiguration config, Map optionMap) {
String outputLocation = "."; //default output directory is the current working directory
- CommandLineOption outputLocationOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG, optionMap);
+ CommandLineOption commandLineOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG, optionMap);
- if (outputLocationOption != null) {
- outputLocation = outputLocationOption.getOptionValue();
+ if (commandLineOption != null) {
+ outputLocation = commandLineOption.getOptionValue();
}
File outputLocationFile = new File(outputLocation);
config.setOutputLocation(outputLocationFile);
@@ -68,54 +68,48 @@
config.setSyncOn(true);
}
- CommandLineOption packageOption = loadOption(WSDL2JavaConstants.PACKAGE_OPTION, WSDL2JavaConstants.PACKAGE_OPTION_LONG, optionMap);
- if (packageOption != null) {
- config.setPackageName(packageOption.getOptionValue());
+ commandLineOption = loadOption(WSDL2JavaConstants.PACKAGE_OPTION, WSDL2JavaConstants.PACKAGE_OPTION_LONG, optionMap);
+ if (commandLineOption != null) {
+ config.setPackageName(commandLineOption.getOptionValue());
}
- CommandLineOption langOption = loadOption(WSDL2JavaConstants.STUB_LANGUAGE_OPTION, WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG, optionMap);
+ commandLineOption = loadOption(WSDL2JavaConstants.STUB_LANGUAGE_OPTION, WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG, optionMap);
//The language here
- if (langOption != null) {
- config.setOutputLanguage(langOption.getOptionValue());
+ if (commandLineOption != null) {
+ config.setOutputLanguage(commandLineOption.getOptionValue());
}
- CommandLineOption dataBindingOption = loadOption(WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG, optionMap);
- if (dataBindingOption != null) {
- config.setDatabindingType(dataBindingOption.getOptionValue());
+ commandLineOption = loadOption(WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG, optionMap);
+ if (commandLineOption != null) {
+ config.setDatabindingType(commandLineOption.getOptionValue());
}
- CommandLineOption unwrapClassesOption = loadOption(WSDL2JavaConstants.UNPACK_CLASSES_OPTION, WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG, optionMap);
- if (unwrapClassesOption != null) {
+ commandLineOption = loadOption(WSDL2JavaConstants.UNPACK_CLASSES_OPTION, WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG, optionMap);
+ if (commandLineOption != null) {
config.setPackClasses(false);
}
- CommandLineOption portNameOption = loadOption(WSDL2JavaConstants.PORT_NAME_OPTION, WSDL2JavaConstants.PORT_NAME_OPTION_LONG, optionMap);
- config.setPortName(portNameOption != null ? portNameOption.getOptionValue() : null);
+ commandLineOption = loadOption(WSDL2JavaConstants.PORT_NAME_OPTION, WSDL2JavaConstants.PORT_NAME_OPTION_LONG, optionMap);
+ config.setPortName(commandLineOption != null ? commandLineOption.getOptionValue() : null);
- CommandLineOption serviceNameOption = loadOption(WSDL2JavaConstants.SERVICE_NAME_OPTION, WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG, optionMap);
- config.setServiceName(serviceNameOption != null ? serviceNameOption.getOptionValue() : null);
+ commandLineOption = loadOption(WSDL2JavaConstants.SERVICE_NAME_OPTION, WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG, optionMap);
+ config.setServiceName(commandLineOption != null ? commandLineOption.getOptionValue() : null);
- CommandLineOption repositoryPathOption = loadOption(WSDL2JavaConstants.REPOSITORY_PATH_OPTION, WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG, optionMap);
- config.setRepositoryPath(repositoryPathOption != null ? repositoryPathOption.getOptionValue() : null);
+ commandLineOption = loadOption(WSDL2JavaConstants.REPOSITORY_PATH_OPTION, WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG, optionMap);
+ config.setRepositoryPath(commandLineOption != null ? commandLineOption.getOptionValue() : null);
- CommandLineOption serverSideInterfaceOption = loadOption(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG, optionMap);
- if (serverSideInterfaceOption != null){
- config.setServerSideInterface(true);
- }
+ config.setServerSideInterface(loadOption(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG, optionMap)!=null);
- CommandLineOption generateAllOption = loadOption(WSDL2JavaConstants.GENERATE_ALL_OPTION, WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG, optionMap);
- if (generateAllOption != null) {
- config.setGenerateAll(true);
- }
+ config.setGenerateAll(loadOption(WSDL2JavaConstants.GENERATE_ALL_OPTION, WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG, optionMap)!=null);
//populate the external mapping
- CommandLineOption externalMapping = loadOption(
+ commandLineOption = loadOption(
WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION,
WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION_LONG,
optionMap);
- if (externalMapping!=null){
+ if (commandLineOption!=null){
try {
- config.setTypeMappingFile(new File(externalMapping.getOptionValue()));
+ config.setTypeMappingFile(new File(commandLineOption.getOptionValue()));
} catch (Exception e) {
throw new RuntimeException(
CodegenMessages.getMessage("options.nomappingFile"), e);
@@ -123,14 +117,14 @@
}
// load the namespace to package list
- CommandLineOption ns2packageOption = loadOption(
+ commandLineOption = loadOption(
WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION_LONG,
optionMap);
- if (ns2packageOption != null) {
+ if (commandLineOption != null) {
//the syntax for the value of the namespaces and packages is
//to be a comma seperated list with uri=packagename,uri=packagename...
- String value = ns2packageOption.getOptionValue();
+ String value = commandLineOption.getOptionValue();
if (value != null) {
// Try treating the values as a name=value pair separated by comma's
if (value.indexOf('=') != -1) {
@@ -161,20 +155,25 @@
}
}
- CommandLineOption wsdlVersionOption =
+ commandLineOption =
loadOption(WSDL2JavaConstants.WSDL_VERSION_OPTION,
- WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG,
- optionMap);
- if (wsdlVersionOption!=null){
- String optionValue = wsdlVersionOption.getOptionValue();
+ WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG,
+ optionMap);
+ if (commandLineOption!=null){
+ String optionValue = commandLineOption.getOptionValue();
if (WSDL2JavaConstants.WSDL_VERSION_2.equals(optionValue) ||
- WSDL2JavaConstants.WSDL_VERSION_2_OPTIONAL.equals(optionValue) ){
- //users can say either 2.0 or 2 - we just set it to the constant
- config.setWSDLVersion(WSDL2JavaConstants.WSDL_VERSION_2);
+ WSDL2JavaConstants.WSDL_VERSION_2_OPTIONAL.equals(optionValue) ){
+ //users can say either 2.0 or 2 - we just set it to the constant
+ config.setWSDLVersion(WSDL2JavaConstants.WSDL_VERSION_2);
} //ignore the other cases - they'll be taken as 1.1
}
+
+ config.setFlattenFiles(loadOption(WSDL2JavaConstants.FLATTEN_FILES_OPTION,
+ WSDL2JavaConstants.FLATTEN_FILES_OPTION_LONG,
+ optionMap)!=null);
+
//loop through the map and find parameters having the extra prefix.
//put them in the property map
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Tue Jun 13 05:54:28 2006
@@ -1,6 +1,5 @@
package org.apache.axis2.wsdl.codegen.emitter;
-import com.ibm.wsdl.util.xml.DOM2Writer;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -167,9 +166,15 @@
protected Map faultClassNameMap = new HashMap();
protected Map instantiatableMessageClassNames = new HashMap();
- ;
+ protected static final String SRC_DIR_NAME = "src";
+ protected static final String TEST_SRC_DIR_NAME = "test";
+ protected static final String RESOURCE_SRC_DIR_NAME = "resources";
+
+ /**
+ * default constructor - builds
+ */
public AxisServiceBasedMultiLanguageEmitter() {
infoHolder = new HashMap();
}
@@ -297,11 +302,15 @@
writeTestClasses();
// write an ant build file
- //Note that ant build is generated only once
- //and that has to happen here only if the
- //client side code is required
+ // Note that ant build is generated only once
+ // and that has to happen here only if the
+ // client side code is required
if (!codeGenConfiguration.isGenerateAll()) {
- writeAntBuild();
+ //our logic for the build xml is that it will
+ //only be written when not flattened
+ if (!codeGenConfiguration.isFlattenFiles()){
+ writeAntBuild();
+ }
}
}
@@ -356,7 +365,10 @@
Document classModel = createDOMDocumentForTestCase();
debugLogDocument("Document for test case:", classModel);
TestClassWriter callbackWriter =
- new TestClassWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "test"),
+ new TestClassWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), TEST_SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(classModel, callbackWriter);
@@ -398,7 +410,10 @@
Document interfaceImplModel = createDOMDocumentForInterfaceImplementation();
debugLogDocument("Document for interface implementation:", interfaceImplModel);
InterfaceImplementationWriter writer =
- new InterfaceImplementationWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new InterfaceImplementationWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(interfaceImplModel, writer);
@@ -471,9 +486,6 @@
//add another element to have the unique list of faults
rootElement.appendChild(getUniqueListofFaults(doc));
- /////////////////////////////////////////////////////
-// System.out.println(DOM2Writer.nodeToString(rootElement));
- /////////////////////////////////////////////////////
doc.appendChild(rootElement);
@@ -583,7 +595,10 @@
Document interfaceModel = createDOMDocumentForCallbackHandler();
debugLogDocument("Document for callback handler:", interfaceModel);
CallbackHandlerWriter callbackWriter =
- new CallbackHandlerWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new CallbackHandlerWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(interfaceModel, callbackWriter);
@@ -616,7 +631,10 @@
Document interfaceModel = createDOMDocumentForInterface(writeDatabinders);
debugLogDocument("Document for interface:", interfaceModel);
InterfaceWriter interfaceWriter =
- new InterfaceWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new InterfaceWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
this.codeGenConfiguration.getOutputLanguage());
writeClass(interfaceModel, interfaceWriter);
@@ -728,7 +746,11 @@
writeServiceXml();
//write the ant build
- writeAntBuild();
+ //we skip this for the flattened case
+ if (!codeGenConfiguration.isFlattenFiles()) {
+ writeAntBuild();
+ }
+
//for the server side codegen
//we need to serialize the WSDL's
@@ -753,7 +775,11 @@
//now get the schema list and write it out
SchemaWriter schemaWriter = new SchemaWriter(
- codeGenConfiguration.getOutputLocation());
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), RESOURCE_SRC_DIR_NAME));
+
+
Hashtable schemaMappings = axisService.getSchemaMappingTable();
Iterator keys = schemaMappings.keySet().iterator();
while (keys.hasNext()) {
@@ -767,13 +793,19 @@
//switch between the correct writer
if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(codeGenConfiguration.getWSDLVersion())){
+
WSDL20Writer wsdl20Writer = new WSDL20Writer(
- codeGenConfiguration.getOutputLocation());
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), RESOURCE_SRC_DIR_NAME)
+ );
wsdl20Writer.writeWSDL(axisService);
}else{
WSDL11Writer wsdl11Writer = new WSDL11Writer(
- codeGenConfiguration.getOutputLocation());
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), RESOURCE_SRC_DIR_NAME));
wsdl11Writer.writeWSDL(axisService);
}
@@ -842,7 +874,10 @@
//write the class only if any methods are found
if (Boolean.TRUE.equals(infoHolder.get(mep))) {
MessageReceiverWriter writer =
- new MessageReceiverWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new MessageReceiverWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(classModel, writer);
@@ -896,9 +931,6 @@
doc.appendChild(rootElement);
- //////////////////////////////////
-// System.out.println(DOM2Writer.nodeToString(rootElement));
- ////////////////////////////////
return doc;
}
@@ -1053,7 +1085,7 @@
* expect the fully qulified class names to be present in the class names list due to the simple
* reason that they've not been written yet! Hence the mappers class name list needs to be updated
* to suit the expected package to be written
- * in this case we modify the package name to have make the class a inner class of the stub,
+ * in this case we modify the package name to have the class a inner class of the stub,
* interface or the message receiver depending on the style
*/
protected void updateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix) {
@@ -1081,7 +1113,10 @@
Document serviceXMLModel = createDOMDocumentForServiceXML();
debugLogDocument("Document for service XML:", serviceXMLModel);
ClassWriter serviceXmlWriter =
- new ServiceXMLWriter(getOutputDirectory(this.codeGenConfiguration.getOutputLocation(), "resources"),
+ new ServiceXMLWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), RESOURCE_SRC_DIR_NAME),
this.codeGenConfiguration.getOutputLanguage());
writeClass(serviceXMLModel, serviceXmlWriter);
@@ -1122,16 +1157,17 @@
loadOperations(doc, rootElement, null);
- System.out.println(DOM2Writer.nodeToString(rootElement));
-
return rootElement;
}
protected void writeSkeleton() throws Exception {
Document skeletonModel = createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface());
debugLogDocument("Document for skeleton:", skeletonModel);
- ClassWriter skeletonWriter = new SkeletonWriter(getOutputDirectory(this.codeGenConfiguration.getOutputLocation(),
- "src"), this.codeGenConfiguration.getOutputLanguage());
+ ClassWriter skeletonWriter = new SkeletonWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME)
+ , this.codeGenConfiguration.getOutputLanguage());
writeClass(skeletonModel, skeletonWriter);
}
@@ -1144,8 +1180,11 @@
protected void writeSkeletonInterface() throws Exception {
Document skeletonModel = createDOMDocumentForSkeletonInterface();
debugLogDocument("Document for skeleton Interface:", skeletonModel);
- ClassWriter skeletonInterfaceWriter = new SkeletonInterfaceWriter(getOutputDirectory(this.codeGenConfiguration.getOutputLocation(),
- "src"), this.codeGenConfiguration.getOutputLanguage());
+ ClassWriter skeletonInterfaceWriter = new SkeletonInterfaceWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME)
+ , this.codeGenConfiguration.getOutputLanguage());
writeClass(skeletonModel, skeletonInterfaceWriter);
}
@@ -1170,8 +1209,6 @@
//attach a list of faults
rootElement.appendChild(getUniqueListofFaults(doc));
-// System.out.println(DOM2Writer.nodeToString(rootElement));
-
doc.appendChild(rootElement);
return doc;
@@ -1391,11 +1428,14 @@
* @return Returns File.
*/
protected File getOutputDirectory(File outputDir, String dir2) {
- outputDir = new File(outputDir, dir2);
+ if (dir2!=null && !"".equals(dir2)){
+ outputDir = new File(outputDir, dir2);
+ }
if (!outputDir.exists()) {
outputDir.mkdirs();
}
+
return outputDir;
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java Tue Jun 13 05:54:28 2006
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.wsdl.codegen.emitter;
import org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter;
@@ -51,7 +51,10 @@
Document interfaceImplModel = createDOMDocumentForInterfaceImplementation();
CHeaderWriter writerH =
- new CHeaderWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new CHeaderWriter(
+ codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(interfaceImplModel, writerH);
@@ -68,7 +71,9 @@
Document interfaceImplModel = createDOMDocumentForInterfaceImplementation();
CSourceWriter writerC =
- new CSourceWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ new CSourceWriter(codeGenConfiguration.isFlattenFiles()?
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), null):
+ getOutputDirectory(codeGenConfiguration.getOutputLocation(), SRC_DIR_NAME),
codeGenConfiguration.getOutputLanguage());
writeClass(interfaceImplModel, writerC);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Tue Jun 13 05:54:28 2006
@@ -2,6 +2,14 @@
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -27,9 +35,36 @@
public class SchemaUnwrapperExtension extends AbstractCodeGenerationExtension {
public void engage(CodeGenConfiguration configuration) throws CodeGenerationException {
- if (!configuration.isParametersWrapped()){
-// //unwrap the schema since we are told to do so
-// SchemaUnwrapper.unwrap(configuration.getWom());
- }
+ if (!configuration.isParametersWrapped()){
+ //walk the schema and find the top level elements
+ AxisService axisService = configuration.getAxisService();
+ List schemaList = axisService.getSchema();
+ for (int i = 0; i < schemaList.size(); i++) {
+ walkSchema((XmlSchema)schemaList.get(i));
+ }
+
+
+
+
+
+
+
+
+
+ }
+ }
+
+ //walk the given schema
+ public void walkSchema(XmlSchema schema){
+ //get the schema and find the elements
+ XmlSchemaObjectTable elementTable = schema.getElements();
+ for (Iterator it = elementTable.getValues();
+ it.hasNext();){
+ //take the type of the schema element
+
+ }
+
+
+
}
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java Tue Jun 13 05:54:28 2006
@@ -28,7 +28,8 @@
private static final String ADB_INVOKE_CLASS_NAME =
"org.apache.axis2.schema.ExtensionUtility";
- private static final String INVOKE_METHOD_NAME = "invoke";
+ private static final String INVOKE_METHOD_NAME =
+ "invoke";
/**
*
@@ -39,7 +40,6 @@
return;
}
try {
-
//invoke the adb codegen by reflection
Class adbGeneratorClass = Class.
forName(ADB_INVOKE_CLASS_NAME);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SchemaWriter.java Tue Jun 13 05:54:28 2006
@@ -38,7 +38,7 @@
if (schema!= null){
//create a output file
File outputFile = FileWriter.createClassFile(baseFolder,
- "resources",
+ null,
schemaFileName.substring(0,schemaFileName.lastIndexOf(".")),
".xsd");
FileOutputStream fos = new FileOutputStream(outputFile);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java Tue Jun 13 05:54:28 2006
@@ -34,7 +34,7 @@
if (axisService!= null){
//create a output file
File outputFile = FileWriter.createClassFile(baseFolder,
- "resources",
+ null,
axisService.getName(),
".wsdl");
FileOutputStream fos = new FileOutputStream(outputFile);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java Tue Jun 13 05:54:28 2006
@@ -34,7 +34,7 @@
if (axisService!= null){
//create a output file
File outputFile = FileWriter.createClassFile(baseFolder,
- "resources",
+ null,
axisService.getName(),
".wsdl");
FileOutputStream fos = new FileOutputStream(outputFile);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java Tue Jun 13 05:54:28 2006
@@ -40,6 +40,7 @@
String SERVER_SIDE_INTERFACE_OPTION = "ssi";
String EXTERNAL_MAPPING_OPTION = "em";
String WSDL_VERSION_OPTION = "wv";
+ String FLATTEN_FILES_OPTION = "f";
//long option constants
@@ -63,6 +64,7 @@
String SERVER_SIDE_INTERFACE_OPTION_LONG = "serverside-interface";
String EXTERNAL_MAPPING_OPTION_LONG = "external-mapping";
String WSDL_VERSION_OPTION_LONG = "wsdl-version";
+ String FLATTEN_FILES_OPTION_LONG = "flatten-filess";
String WSDL_VERSION_2 = "2.0";
String WSDL_VERSION_2_OPTIONAL = "2";
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Tue Jun 13 05:54:28 2006
@@ -45,6 +45,7 @@
(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.WSDL_VERSION_OPTION).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.FLATTEN_FILES_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG).equalsIgnoreCase(optionType) ||
@@ -62,6 +63,8 @@
(WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION_LONG).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.FLATTEN_FILES_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG).equalsIgnoreCase(optionType)
);
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTConstants.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTConstants.java Tue Jun 13 05:54:28 2006
@@ -19,8 +19,8 @@
//todo rename this
public interface XSLTConstants {
- String BASE_64_PROPERTY_KEY = "base64map";
- String PLAIN_BASE_64_PROPERTY_KEY = "plainbase64map";
+ String BASE_64_PROPERTY_KEY = "base64map";
+ String PLAIN_BASE_64_PROPERTY_KEY = "plainbase64map";
String EXTERNAL_TEMPLATE_PROPERTY_KEY = "externalTemplate";
String XSLT_INCLUDE_DATABIND_SUPPORTER_HREF_KEY = "databindsupporter";
@@ -28,9 +28,9 @@
public interface CodegenStyle {
- public static final int AUTOMATIC = 0;
- public static final int INTERFACE = 1;
- public static final int BINDING = 2;
+ final int AUTOMATIC = 0;
+ final int INTERFACE = 1;
+ static final int BINDING = 2;
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java Tue Jun 13 05:54:28 2006
@@ -34,12 +34,22 @@
public XSLTIncludeResolver() {
}
+ /**
+ *
+ * @param config
+ */
public XSLTIncludeResolver(CodeGenConfiguration config) {
this.configuration = config;
}
-
+ /**
+ * Resolves a given href and base combination
+ * @param href
+ * @param base
+ * @return
+ * @throws TransformerException
+ */
public Source resolve(String href, String base) throws TransformerException {
String templateName;
Map externalPropertyMap = configuration.getProperties();
@@ -74,6 +84,12 @@
return getEmptySource();
}
+ /**
+ * load the template from a given resource path
+ * @param templateName
+ * @return the loaded transform source
+ * @throws TransformerException
+ */
private Source getSourceFromTemplateName(String templateName) throws TransformerException {
InputStream supporterTemplateStream;
if(templateName!=null){
@@ -84,6 +100,10 @@
}
}
+ /**
+ * returns an empty source
+ * @return
+ */
private Source getEmptySource(){
return new StreamSource(new ByteArrayInputStream("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"/>".getBytes()));
}
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?rev=413891&r1=413890&r2=413891&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Tue Jun 13 05:54:28 2006
@@ -166,7 +166,7 @@
convertToSchemaArray(topLevelSchemaList),
new Axis2BindingConfig(cgconfig.getUri2PackageNameMap()),
XmlBeans.getContextTypeLoader(),
- new Axis2Filer(cgconfig.getOutputLocation()),
+ new Axis2Filer(cgconfig),
new XmlOptions().setEntityResolver(er));
// prune the generated schema type system and add the list of base64 types
@@ -209,6 +209,7 @@
//add the document types and global types
allSeenTypes.addAll(Arrays.asList(sts.documentTypes()));
allSeenTypes.addAll(Arrays.asList(sts.globalTypes()));
+
for (int i = 0; i < allSeenTypes.size(); i++) {
SchemaType sType = (SchemaType) allSeenTypes.get(i);
@@ -220,7 +221,10 @@
SchemaProperty[] properties = sType.getProperties();
for (int j = 0; j < properties.length; j++) {
if (Constants.XMIME_CONTENT_TYPE_QNAME.equals(properties[j].getName())) {
- base64ElementQNamesList.add(outerType.getDocumentElementName());
+ //add this only if it is a document type ??
+ if (outerType.isDocumentType()){
+ base64ElementQNamesList.add(outerType.getDocumentElementName());
+ }
break;
}
}
@@ -291,14 +295,23 @@
private static class Axis2Filer implements Filer {
private File location;
-
- private Axis2Filer(File loc) {
- location = loc;
+ private boolean flatten = false;
+ private static final String RESOURCE_DIR_NAME = "resources";
+ private static final String SOURCE_DIR_NAME = "src";
+ private static final String JAVA_FILE_EXTENSION = ".java";
+
+ private Axis2Filer(CodeGenConfiguration config) {
+ location = config.getOutputLocation();
+ flatten = config.isFlattenFiles();
}
public OutputStream createBinaryFile(String typename)
throws IOException {
- File resourcesDirectory = new File(location, "resources");
+ File resourcesDirectory =
+ flatten?
+ location:
+ new File(location, RESOURCE_DIR_NAME);
+
if (!resourcesDirectory.exists()) {
resourcesDirectory.mkdirs();
}
@@ -312,12 +325,17 @@
throws IOException {
typename =
typename.replace('.', File.separatorChar);
- File outputDir = new File(location, "src");
+
+ File outputDir =
+ flatten?
+ location:
+ new File(location, SOURCE_DIR_NAME);
+
if (!outputDir.exists()) {
outputDir.mkdirs();
}
File file = new File(outputDir,
- typename + ".java");
+ typename + JAVA_FILE_EXTENSION);
file.getParentFile().mkdirs();
file.createNewFile();
return new FileWriter(file);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org