You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2006/04/19 12:54:14 UTC
svn commit: r395209 - in
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2:
schema/writer/ wsdl/codegen/emitter/ wsdl/codegen/extension/
wsdl/template/java/ wsdl/util/
Author: ajith
Date: Wed Apr 19 03:54:10 2006
New Revision: 395209
URL: http://svn.apache.org/viewcvs?rev=395209&view=rev
Log:
1. Fixed the custom namespace mapping for ADB
2. Fixed a minor bug in the SkeletonTemplate.xsl
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.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/extension/SimpleDBExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=395209&r1=395208&r2=395209&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Wed Apr 19 03:54:10 2006
@@ -77,6 +77,8 @@
private Map baseTypeMap = new JavaTypeMap().getTypeMap();
+ private Map ns2packageNameMap = new HashMap();
+
/**
* Default constructor
*/
@@ -124,6 +126,10 @@
XSLTUtils.addAttribute(globalWrappedDocument, "package", tempPackageName, rootElement);
}
+
+ //add the ns mappings
+ this.ns2packageNameMap = options.getNs2PackageMap();
+
} catch (IOException e) {
throw new SchemaCompilationException(e);
} catch (ParserConfigurationException e) {
@@ -161,7 +167,7 @@
* @see BeanWriter#write(org.apache.ws.commons.schema.XmlSchemaComplexType, java.util.Map, org.apache.axis2.schema.BeanWriterMetaInfoHolder)
*/
public String write(XmlSchemaComplexType complexType, Map typeMap, BeanWriterMetaInfoHolder metainf, String fullyQualifiedClassName)
- throws SchemaCompilationException {
+ throws SchemaCompilationException {
try {
//determine the package for this type.
@@ -236,11 +242,18 @@
*/
public String makeFullyQualifiedClassName(QName qName) {
- String packageNameFromURL = URLProcessor.makePackageName(qName.getNamespaceURI());
+ String namespaceURI = qName.getNamespaceURI();
+ String basePackageName;
+
+ if (ns2packageNameMap.containsKey(namespaceURI)){
+ basePackageName = (String)ns2packageNameMap.get(namespaceURI);
+ }else{
+ basePackageName = URLProcessor.makePackageName(namespaceURI);
+ }
String packageName = this.packageName == null ?
- packageNameFromURL :
- this.packageName + packageNameFromURL;
+ basePackageName :
+ this.packageName + basePackageName;
String originalName = qName.getLocalPart();
String className = makeUniqueJavaClassName(this.namesList, originalName);
@@ -248,6 +261,7 @@
String packagePrefix = null;
String fullyqualifiedClassName;
+
if (wrapClasses)
packagePrefix = (this.packageName == null ? DEFAULT_PACKAGE+"." : this.packageName) + WRAPPED_DATABINDING_CLASS_NAME;
else if (writeClasses)
@@ -259,7 +273,7 @@
//return the fully qualified class name
return fullyqualifiedClassName;
}
-
+
/**
* A util method that holds common code
* for the complete schema that the generated XML complies to
@@ -274,19 +288,18 @@
* @throws Exception
*/
private String process(QName qName, BeanWriterMetaInfoHolder metainf, Map typeMap, boolean isElement, String fullyQualifiedClassName) throws Exception {
-
+
if (fullyQualifiedClassName == null)
fullyQualifiedClassName = makeFullyQualifiedClassName(qName);
String className = fullyQualifiedClassName.substring(1+fullyQualifiedClassName.lastIndexOf('.'));
-
- String nameSpaceFromURL = URLProcessor.makePackageName(qName.getNamespaceURI());
-
- String packageName = this.packageName == null ?
- nameSpaceFromURL :
- this.packageName + nameSpaceFromURL;
+ String basePackageName;
+ if (fullyQualifiedClassName.lastIndexOf('.')==-1){// no 'dots' so the package is not there
+ basePackageName = "";
+ }else{
+ basePackageName = fullyQualifiedClassName.substring(0,fullyQualifiedClassName.lastIndexOf('.'));
+ }
String originalName = qName.getLocalPart();
-
ArrayList propertyNames = new ArrayList();
if (!templateLoaded) {
@@ -297,18 +310,18 @@
//global class that is generated, one needs to call the writeBatch() method
if (wrapClasses) {
globalWrappedDocument.getDocumentElement().appendChild(
- getBeanElement(globalWrappedDocument, className, originalName, packageName, qName, isElement, metainf, propertyNames, typeMap)
+ getBeanElement(globalWrappedDocument, className, originalName, basePackageName, qName, isElement, metainf, propertyNames, typeMap)
);
} else {
//create the model
Document model = XSLTUtils.getDocument();
//make the XML
- model.appendChild(getBeanElement(model, className, originalName, packageName, qName, isElement, metainf, propertyNames, typeMap));
+ model.appendChild(getBeanElement(model, className, originalName, basePackageName, qName, isElement, metainf, propertyNames, typeMap));
if (writeClasses){
//create the file
- File out = createOutFile(packageName, className);
+ File out = createOutFile(basePackageName, className);
//parse with the template and create the files
parse(model, out);
}
@@ -494,7 +507,7 @@
XSLTUtils.addAttribute(model, "any", "yes", property);
}
- if (metainf.getBinaryStatusForQName(name)) {
+ if (metainf.getBinaryStatusForQName(name)) {
XSLTUtils.addAttribute(model, "binary", "yes", property);
}
//put the min occurs count irrespective of whether it's an array or not
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=395209&r1=395208&r2=395209&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 Wed Apr 19 03:54:10 2006
@@ -697,9 +697,6 @@
//write the ant build
writeAntBuild();
-
- log.info(CodegenMessages.getMessage("emitter.logEntryInterface1"));
- log.info(CodegenMessages.getMessage("emitter.logEntryInterface2"));
}
private void copyToFaultMap() {
@@ -804,7 +801,7 @@
//attach a list of faults
rootElement.appendChild(getUniqueListofFaults(doc));
-
+
doc.appendChild(rootElement);
//////////////////////////////////
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=395209&r1=395208&r2=395209&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 Wed Apr 19 03:54:10 2006
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
/**
* Extension for simple data binding.
@@ -180,7 +181,7 @@
if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.PACKAGE)){
String packageName = (String)propertyMap.get(SchemaConstants.SchemaCompilerArguments.PACKAGE);
if (packageName!=null || !"".equals(packageName)){
- options.setPackageName(packageName);
+ options.setPackageName(packageName);
}
}
@@ -200,6 +201,9 @@
/// these options need to be taken from the command line
options.setOutputLocation(outputDir);
+ options.setNs2PackageMap(configuration.getUri2PackageNameMap()==null?
+ new HashMap():
+ configuration.getUri2PackageNameMap());
//default setting is to set the wrap status depending on whether it's
//the server side or the client side
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl?rev=395209&r1=395208&r2=395209&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl Wed Apr 19 03:54:10 2006
@@ -24,7 +24,7 @@
<xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
</xsl:text></xsl:if></xsl:for-each>
*/
- public <xsl:if test="$count=0">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ public <xsl:if test="$count=0 or $outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>
(<xsl:for-each select="input/param[@location='body']">
<xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/></xsl:if>
</xsl:for-each> )
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=395209&r1=395208&r2=395209&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 Wed Apr 19 03:54:10 2006
@@ -41,6 +41,7 @@
(WSDL2JavaConstants.PORT_NAME_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVICE_NAME_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.REPOSITORY_PATH_OPTION).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG).equalsIgnoreCase(optionType) ||
@@ -55,6 +56,7 @@
(WSDL2JavaConstants.PORT_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.REPOSITORY_PATH_OPTION_LONG).equalsIgnoreCase(optionType)
);