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 de...@apache.org on 2007/06/20 15:58:13 UTC
svn commit: r549110 [1/2] - in /webservices/axis2/trunk/java/modules:
java2wsdl/src/org/apache/ws/java2wsdl/ jaxbri/
jaxbri/src/org/apache/axis2/jaxbri/
kernel/src/org/apache/axis2/deployment/util/
kernel/src/org/apache/axis2/description/ kernel/src/or...
Author: deepal
Date: Wed Jun 20 06:58:09 2007
New Revision: 549110
URL: http://svn.apache.org/viewvc?view=rev&rev=549110
Log:
Part1- DocLitbare WSDL generation
- Now we have ?wsdl generation for doclitbare , to have doclit-bare support you need to add the following parameter into services.xml
<parameter name="doclitBare">true</parameter>
And when java2wsdl if you want to generate doc-lit bare then pass either one of parameter
- dlb
- doclitbare
I did not test the doc-lit bare with codegeneration , I wil lstart that immediatly after this commit.
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java
Modified:
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
webservices/axis2/trunk/java/modules/jaxbri/project.xml
webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Wed Jun 20 06:58:09 2007
@@ -1,12 +1,7 @@
package org.apache.ws.java2wsdl;
import org.apache.axiom.om.OMElement;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
-import org.apache.axis2.description.java2wsdl.NamespaceGenerator;
-import org.apache.axis2.description.java2wsdl.DefaultNamespaceGenerator;
-import org.apache.axis2.description.java2wsdl.Java2WSDLUtils;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.*;
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisService2WSDL11;
@@ -70,6 +65,7 @@
private boolean pretty = true;
private String wsdlVersion = WSDL_VERSION_1;
private String schemaGenClassName = null;
+ private boolean generateDocLitBare =false;
public String getSchemaTargetNamespace() throws Exception {
if ( schemaTargetNamespace == null ) {
@@ -151,11 +147,15 @@
this.wsdlPrefix = wsdlPrefix;
}
- /**
- * @param out
- * @param className
- * @param classLoader
- */
+
+ public boolean isGenerateDocLitBare() {
+ return generateDocLitBare;
+ }
+
+ public void setGenerateDocLitBare(boolean generateDocLitBare) {
+ this.generateDocLitBare = generateDocLitBare;
+ }
+
public Java2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) {
this.out = out;
this.className = className;
@@ -163,11 +163,7 @@
}
- /**
- * Externally visible generator method
- *
- * @throws Exception
- */
+
public void generateWSDL() throws Exception {
SchemaGenerator schemaGenerator = resolveSchemaGen(classLoader,
className,
@@ -203,13 +199,16 @@
WSDL2Constants.MEP_URI_IN_OUT,
inOutmessageReceiver);
ConfigurationContext configCtx = ConfigurationContextFactory.createDefaultConfigurationContext();
+ AxisService service = new AxisService ();
+ schemaGenerator.setAxisService(service);
AxisService axisService = AxisService.createService(className,
serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName,
configCtx.getAxisConfiguration(),
messageReciverMap,
targetNamespace == null ? Java2WSDLUtils.namespaceFromClassName(className, classLoader, resolveNSGen()).toString() : targetNamespace,
classLoader,
- schemaGenerator);
+ schemaGenerator,service);
+ schemaGenerator.setAxisService(axisService);
axisService.setTargetNamespacePrefix(targetNamespacePrefix);
axisService.setSchemaTargetNamespace(getSchemaTargetNamespace());
axisService.setSchematargetNamespacePrefix(getSchemaTargetNamespacePrefix());
@@ -293,7 +292,7 @@
}
private NamespaceGenerator resolveNSGen() {
- NamespaceGenerator nsGen = null;
+ NamespaceGenerator nsGen ;
if(this.nsGenClassName == null){
nsGen = new DefaultNamespaceGenerator();
} else {
@@ -309,9 +308,18 @@
private SchemaGenerator resolveSchemaGen(ClassLoader loader, String className,
String schematargetNamespace,
String schematargetNamespacePrefix) throws Exception {
- SchemaGenerator schemaGen = null;
+ SchemaGenerator schemaGen ;
if(this.schemaGenClassName == null){
- schemaGen = new DefaultSchemaGenerator(loader, className, schematargetNamespace, schematargetNamespacePrefix);
+ if (generateDocLitBare) {
+ schemaGen = new DocLitBareSchemaGenerator(
+ loader, className, schematargetNamespace,
+ schematargetNamespacePrefix,null);
+ } else {
+ schemaGen = new DefaultSchemaGenerator(
+ loader, className, schematargetNamespace,
+ schematargetNamespacePrefix,null);
+ }
+
} else {
try {
Class clazz = Class.forName(this.schemaGenClassName);
@@ -320,7 +328,16 @@
schemaGen = (SchemaGenerator) constructor.newInstance(
new Object[]{loader, className, schematargetNamespace, schematargetNamespacePrefix});
} catch ( Exception e ) {
- schemaGen = new DefaultSchemaGenerator(loader, className, schematargetNamespace, schematargetNamespacePrefix);
+ if (generateDocLitBare) {
+ schemaGen = new DocLitBareSchemaGenerator(
+ loader, className, schematargetNamespace,
+ schematargetNamespacePrefix,null);
+ } else {
+ schemaGen = new DefaultSchemaGenerator(
+ loader, className, schematargetNamespace,
+ schematargetNamespacePrefix,null);
+ }
+
}
}
return schemaGen;
Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java Wed Jun 20 06:58:09 2007
@@ -214,13 +214,15 @@
java2WsdlBuilder.setWSDLVersion(Java2WSDLConstants.WSDL_VERSION_2);
} //ignore the other cases - they'll be taken as 1.1
}
+
+ option = loadOption(Java2WSDLConstants.DOC_LIT_BARE,
+ Java2WSDLConstants.DOC_LIT_BARE_LONG,
+ optionsMap);
+ if (option != null) {
+ java2WsdlBuilder.setGenerateDocLitBare(true);
+ }
}
- /**
- * @param shortOption
- * @param longOption
- * @param options
- */
private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption, Map options) {
//short option gets precedence
Java2WSDLCommandLineOption option = null;
@@ -250,7 +252,7 @@
if (option != null)
{
ArrayList optionValues = option.getOptionValues();
- String anOptionValue = "";
+ String anOptionValue ;
for ( int count = 0 ; count < optionValues.size() ; ++count )
{
anOptionValue = ((String)optionValues.get(count)).trim();
Modified: webservices/axis2/trunk/java/modules/jaxbri/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/project.xml?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxbri/project.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxbri/project.xml Wed Jun 20 06:58:09 2007
@@ -98,6 +98,15 @@
<artifactId>jaxb-api</artifactId>
<version>${jaxbapi.version}</version>
</dependency>
+<dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>${annogen.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
</dependencies>
<build>
Modified: webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java Wed Jun 20 06:58:09 2007
@@ -51,7 +51,7 @@
String schematargetNamespace,
String schematargetNamespacePrefix)
throws Exception {
- super(loader, className, schematargetNamespace, schematargetNamespacePrefix);
+ super(loader, className, schematargetNamespace, schematargetNamespacePrefix,null);
}
public Collection generateSchema() throws Exception {
@@ -117,7 +117,7 @@
return itr.next();
}
- private List<Class<?>> processMethods(Method[] declaredMethods) throws Exception {
+ protected List<Class<?>> processMethods(Method[] declaredMethods) throws Exception {
List<Class<?>> list = new ArrayList<Class<?>>();
for (int i = 0; i < declaredMethods.length; i++) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Wed Jun 20 06:58:09 2007
@@ -6,24 +6,12 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.deployment.DeploymentClassLoader;
+import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.AnnotationConstants;
-import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.*;
+import org.apache.axis2.description.java2wsdl.*;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.engine.MessageReceiver;
@@ -34,29 +22,15 @@
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.codehaus.jam.JAnnotation;
import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JClass;
import javax.xml.namespace.QName;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.*;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.List;
+import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -128,15 +102,15 @@
InputStream in = url.openStream();
String fileName = url.getFile();
int index = fileName.lastIndexOf('/');
- if(index != -1) {
- fileName = fileName.substring(index+1);
+ if (index != -1) {
+ fileName = fileName.substring(index + 1);
}
File f = createTempFile(fileName, in, tmpDir);
in.close();
ZipInputStream zin;
FileInputStream fin = new FileInputStream(f);
- array.add(f.toURL());
- zin = new ZipInputStream(fin);
+ array.add(f.toURL());
+ zin = new ZipInputStream(fin);
ZipEntry entry;
String entryName;
@@ -167,14 +141,14 @@
byte data[] = new byte[2048];
int count;
File f;
- if(tmpDir == null) {
+ if (tmpDir == null) {
new File(System.getProperty("java.io.tmpdir"), "_axis2").mkdirs();
File tempFile = new File(System.getProperty("java.io.tmpdir"), "_axis2");
- f = File.createTempFile("axis2", suffix,tempFile);
+ f = File.createTempFile("axis2", suffix, tempFile);
} else {
f = File.createTempFile("axis2", suffix, tmpDir);
}
- if(log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.info("Created temporary file : " + f.getAbsolutePath());
}
f.deleteOnExit();
@@ -196,7 +170,7 @@
* files inside the "lib/" or "Lib/" subdirectory of the passed directory.
*
* @param parent parent ClassLoader which will be the parent of the result of this method
- * @param file a File which must be a directory for this to be useful
+ * @param file a File which must be a directory for this to be useful
* @return a new ClassLoader pointing to both the passed dir and jar files under lib/
* @throws DeploymentException if problems occur
*/
@@ -261,10 +235,11 @@
/**
* This guy will create a AxisService using java reflection
- * @param axisService the target AxisService
- * @param axisConfig the in-scope AxisConfiguration
+ *
+ * @param axisService the target AxisService
+ * @param axisConfig the in-scope AxisConfiguration
* @param excludeOperations a List of Strings (or null), each containing a method to exclude
- * @param nonRpcMethods a List of Strings (or null), each containing a non-rpc method name
+ * @param nonRpcMethods a List of Strings (or null), each containing a non-rpc method name
* @throws Exception if a problem occurs
*/
public static void fillAxisService(AxisService axisService,
@@ -283,20 +258,20 @@
// other looks.
implInfoParam = axisService.getParameter(Constants.SERVICE_OBJECT_SUPPLIER);
if (implInfoParam != null) {
- String className = ((String)implInfoParam.getValue()).trim();
+ String className = ((String) implInfoParam.getValue()).trim();
Class serviceObjectMaker = Loader.loadClass(serviceClassLoader, className);
- if(serviceObjectMaker.getModifiers() != Modifier.PUBLIC){
- throw new AxisFault("Service class "+ className + " must have public as access Modifier");
+ if (serviceObjectMaker.getModifiers() != Modifier.PUBLIC) {
+ throw new AxisFault("Service class " + className + " must have public as access Modifier");
}
// Find static getServiceObject() method, call it if there
Method method = serviceObjectMaker.
getMethod("getServiceObject",
- new Class[]{AxisService.class});
+ new Class[]{AxisService.class});
Object obj = null;
if (method != null) {
obj = method.invoke(serviceObjectMaker.newInstance(),
- new Object[]{axisService});
+ new Object[]{axisService});
}
if (obj == null) {
log.warn("ServiceObjectSupplier implmentation Object could not be found");
@@ -315,10 +290,19 @@
map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,
Java2WSDLConstants.URI_2001_SCHEMA_XSD);
axisService.setNameSpacesMap(map);
- SchemaGenerator schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
- serviceClass.trim(),
- axisService.getSchematargetNamespace(),
- axisService.getSchemaTargetNamespacePrefix());
+ SchemaGenerator schemaGenerator;
+ Parameter generateBare = axisService.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
+ if (generateBare != null && "true".equals(generateBare.getValue())) {
+ schemaGenerator = new DocLitBareSchemaGenerator(serviceClassLoader,
+ serviceClass.trim(),
+ axisService.getSchematargetNamespace(),
+ axisService.getSchemaTargetNamespacePrefix(), axisService);
+ } else {
+ schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
+ serviceClass.trim(),
+ axisService.getSchematargetNamespace(),
+ axisService.getSchemaTargetNamespacePrefix(), axisService);
+ }
schemaGenerator.setExcludeMethods(excludeOperations);
schemaGenerator.setNonRpcMethods(nonRpcMethods);
if (!axisService.isElementFormDefault()) {
@@ -335,8 +319,7 @@
axisService.setTargetNamespace(schemaGenerator.getTargetNamespace());
}
- JMethod [] method = schemaGenerator.getMethods();
- TypeTable table = schemaGenerator.getTypeTable();
+ JMethod[] method = schemaGenerator.getMethods();
PhasesInfo pinfo = axisConfig.getPhasesInfo();
@@ -345,112 +328,42 @@
String opName = jmethod.getSimpleName();
AxisOperation operation = axisService.getOperation(new QName(opName));
// if the operation there in services.xml then try to set it schema element name
- if (operation != null) {
- AxisMessage inMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (inMessage != null) {
- inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
- QName complexSchemaType = table.getComplexSchemaType(jmethod.getSimpleName());
- inMessage.setElementQName(complexSchemaType);
- if (complexSchemaType != null) {
- axisService.addMessageElementQNameToOperationMapping(complexSchemaType,
- operation);
- }
- }
- if (!jmethod.getReturnType().isVoidType()) {
- AxisMessage outMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- QName qNamefortheType = table.getQNamefortheType(jmethod.getSimpleName() +
- Java2WSDLConstants.RESPONSE);
- outMessage.setElementQName(qNamefortheType);
- if (qNamefortheType != null) {
- axisService.addMessageElementQNameToOperationMapping(qNamefortheType,
- operation);
- }
- outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
- }
- if (jmethod.getExceptionTypes().length > 0) {
- JClass[] extypes = jmethod.getExceptionTypes() ;
- for (int j= 0 ; j < extypes.length ; j++) {
- JClass extype = extypes[j] ;
- if(AxisFault.class.getName().equals(extype.getQualifiedName())){
- continue;
- }
- AxisMessage faultMessage = new AxisMessage();
- String exname = extype.getSimpleName() ;
- if(extypes.length>1){
- faultMessage.setName(jmethod.getSimpleName() + "Fault" + j);
- } else{
- faultMessage.setName(jmethod.getSimpleName() + "Fault");
- }
- faultMessage.setElementQName(
- table.getComplexSchemaType(exname + "Fault"));
- operation.setFaultMessages(faultMessage);
- }
-
- }
+ if (operation == null) {
+ operation = axisService.getOperation(new QName(jmethod.getSimpleName()));
+ }
+ MessageReceiver mr = axisService.getMessageReceiver(
+ operation.getMessageExchangePattern());
+ if (mr != null) {
} else {
- operation = getAxisOperationforJmethod(jmethod, table);
- MessageReceiver mr = axisService.getMessageReceiver(
- operation.getMessageExchangePattern());
- if (mr != null) {
- operation.setMessageReceiver(mr);
- } else {
- mr = axisConfig.getMessageReceiver(operation.getMessageExchangePattern());
- operation.setMessageReceiver(mr);
- }
- pinfo.setOperationPhases(operation);
- axisService.addOperation(operation);
+ mr = axisConfig.getMessageReceiver(operation.getMessageExchangePattern());
+ }
+ if (operation.getMessageReceiver() == null) {
+ operation.setMessageReceiver(mr);
}
+ pinfo.setOperationPhases(operation);
+ axisService.addOperation(operation);
if (operation.getInputAction() == null) {
operation.setSoapAction("urn:" + opName);
}
}
}
- public static AxisOperation getAxisOperationforJmethod(JMethod jmethod,
- TypeTable table) throws AxisFault {
+ public static AxisOperation getAxisOperationForJmethod(JMethod jmethod) throws AxisFault {
AxisOperation operation;
- String opName = jmethod.getSimpleName();
if (jmethod.getReturnType().isVoidType()) {
if (jmethod.getExceptionTypes().length > 0) {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY);
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY);
} else {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY);
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_IN_ONLY);
}
} else {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
- AxisMessage outMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
- Java2WSDLConstants.RESPONSE));
- outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
- }
- if (jmethod.getExceptionTypes().length > 0) {
- JClass[] extypes = jmethod.getExceptionTypes() ;
- for (int j= 0 ; j < extypes.length ; j++) {
- JClass extype = extypes[j] ;
- if(AxisFault.class.getName().equals(extype.getQualifiedName())){
- continue;
- }
- AxisMessage faultMessage = new AxisMessage();
- String exname = extype.getSimpleName() ;
- if(extypes.length >1){
- faultMessage.setName(jmethod.getSimpleName() + "Fault" + j);
- } else {
- faultMessage.setName(jmethod.getSimpleName() + "Fault" );
- }
- faultMessage.setElementQName(
- table.getComplexSchemaType(exname + "Fault"));
- operation.setFaultMessages(faultMessage);
- }
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_IN_OUT);
}
+ String opName = jmethod.getSimpleName();
operation.setName(new QName(opName));
- AxisMessage inMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (inMessage != null) {
- inMessage.setElementQName(table.getComplexSchemaType(jmethod.getSimpleName()));
- inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
- }
JAnnotation methodAnnon = jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
if (methodAnnon != null) {
String action = methodAnnon.getValue(AnnotationConstants.ACTION).asString();
@@ -514,12 +427,12 @@
}
File inputFile = Utils.createTempFile(servicename,
fin,
- (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+ (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
DeploymentFileData filedata = new DeploymentFileData(inputFile);
filedata.setClassLoader(false,
- moduleClassLoader,
- (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+ moduleClassLoader,
+ (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
HashMap wsdlservice = archiveReader.processWSDLs(filedata);
if (wsdlservice != null && wsdlservice.size() > 0) {
Iterator servicesitr = wsdlservice.values().iterator();
@@ -571,15 +484,15 @@
while (st.hasMoreTokens()) {
String token = st.nextToken();
if ("..".equals(token)) {
- if (! clean.isEmpty() && ! "..".equals(clean.getLast())) {
+ if (!clean.isEmpty() && !"..".equals(clean.getLast())) {
clean.removeLast();
- if (! st.hasMoreTokens()) {
+ if (!st.hasMoreTokens()) {
isDir = true;
}
} else {
clean.add("..");
}
- } else if (! ".".equals(token) && ! "".equals(token)) {
+ } else if (!".".equals(token) && !"".equals(token)) {
clean.add(token);
}
}
@@ -603,7 +516,7 @@
Stack parentStack = new Stack();
Stack childStack = new Stack();
if (parent != null) {
- String [] values = parent.split("/");
+ String[] values = parent.split("/");
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
String value = values[i];
@@ -611,7 +524,7 @@
}
}
}
- String [] values = childPath.split("/");
+ String[] values = childPath.split("/");
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
String value = values[i];
@@ -673,7 +586,7 @@
* To add the exclude method when generating scheams , here the exclude methods
* will be session releated axis2 methods
*/
- public static void addExcludeMethods(ArrayList excludeList){
+ public static void addExcludeMethods(ArrayList excludeList) {
excludeList.add("init");
excludeList.add("setOperationContext");
excludeList.add("startUp");
@@ -683,7 +596,7 @@
public static ClassLoader createClassLoader(URL[] urls, ClassLoader serviceClassLoader,
boolean extractJars, File tmpDir) {
- if(extractJars) {
+ if (extractJars) {
URL[] urls1 = Utils.getURLsForAllJars(urls[0], tmpDir);
return new DeploymentClassLoader(urls1, null, serviceClassLoader);
} else {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java Wed Jun 20 06:58:09 2007
@@ -18,6 +18,7 @@
package org.apache.axis2.description;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
import org.apache.axis2.modules.Module;
import org.apache.axis2.phaseresolver.PhaseResolver;
import org.apache.axis2.engine.AxisConfiguration;
@@ -48,6 +49,7 @@
// To store deploy-time module refs
private ArrayList modulerefs;
+ private String partName = Java2WSDLConstants.PARAMETERS;
/**
* list of engaged modules
@@ -240,5 +242,14 @@
public AxisOperation getAxisOperation(){
return (AxisOperation) getParent();
+ }
+
+
+ public String getPartName() {
+ return partName;
+ }
+
+ public void setPartName(String partName) {
+ this.partName = partName;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Wed Jun 20 06:58:09 2007
@@ -20,10 +20,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.*;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
@@ -521,8 +518,6 @@
while (modules.hasNext()) {
AxisModule module = (AxisModule) modules.next();
- AxisServiceGroup parent = (AxisServiceGroup) getParent();
-
try {
Module moduleImpl = module.getModule();
if (moduleImpl != null) {
@@ -1528,11 +1523,15 @@
WSDL2Constants.MEP_URI_IN_OUT,
inOutmessageReceiver);
- return createService(implClass,axisConfig,messageReciverMap,null,null);
+ return createService(implClass,
+ axisConfig,
+ messageReciverMap,
+ null,
+ null,
+ axisConfig.getSystemClassLoader());
} catch (Exception e) {
- log.error(e);
+ throw AxisFault.makeFault(e);
}
- return null;
}
/**
@@ -1568,11 +1567,20 @@
SchemaGenerator schemaGenerator;
ArrayList excludeOpeartion = new ArrayList();
+ AxisService service = new AxisService();
+ service.setName(serviceName);
try {
- schemaGenerator = new DefaultSchemaGenerator(loader,
- implClass, schemaNamespace,
- Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX);
+ Parameter generateBare = service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
+ if (generateBare!=null && "true".equals(generateBare.getValue())) {
+ schemaGenerator = new DocLitBareSchemaGenerator(loader,
+ implClass, schemaNamespace,
+ Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX,service);
+ } else {
+ schemaGenerator = new DefaultSchemaGenerator(loader,
+ implClass, schemaNamespace,
+ Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX,service);
+ }
schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);
Utils.addExcludeMethods(excludeOpeartion);
schemaGenerator.setExcludeMethods(excludeOpeartion);
@@ -1586,7 +1594,7 @@
messageReceiverClassMap,
targetNamespace,
loader,
- schemaGenerator);
+ schemaGenerator,service);
}
/**
* messageReceiverClassMap will hold the MessageReceivers for given meps. Key will be the
@@ -1610,11 +1618,11 @@
Map messageReceiverClassMap,
String targetNamespace,
ClassLoader loader,
- SchemaGenerator schemaGenerator) throws AxisFault {
+ SchemaGenerator schemaGenerator,
+ AxisService axisService) throws AxisFault {
Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, implClass, false);
parameter.setParameterElement(paraElement);
- AxisService axisService = new AxisService();
axisService.setUseDefaultChains(false);
axisService.addParameter(parameter);
axisService.setName(serviceName);
@@ -1640,15 +1648,11 @@
if (targetNamespace != null && !"".equals(targetNamespace)) {
axisService.setTargetNamespace(targetNamespace);
}
-
JMethod[] method = schemaGenerator.getMethods();
- TypeTable table = schemaGenerator.getTypeTable();
-
PhasesInfo pinfo = axisConfiguration.getPhasesInfo();
-
for (int i = 0; i < method.length; i++) {
JMethod jmethod = method[i];
- AxisOperation operation = Utils.getAxisOperationforJmethod(jmethod, table);
+ AxisOperation operation =axisService.getOperation(new QName(jmethod.getSimpleName()));
String mep = operation.getMessageExchangePattern();
MessageReceiver mr;
if (messageReceiverClassMap != null) {
@@ -1682,22 +1686,6 @@
axisService.addOperation(operation);
}
return axisService;
-
- }
-
-
- public static AxisService createService(String implClass,
- AxisConfiguration axisConfiguration,
- Map messageReceiverClassMap,
- String targetNamespace,
- String schemaNamespace) throws AxisFault {
- return createService(implClass,
- axisConfiguration,
- messageReceiverClassMap,
- targetNamespace,
- schemaNamespace,
- axisConfiguration.getServiceClassLoader());
-
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Wed Jun 20 06:58:09 2007
@@ -279,7 +279,7 @@
if(axismessage.getMessagePartName() != null) {
messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getMessagePartName(), null);
} else {
- messagePart.addAttribute(ATTRIBUTE_NAME, "parameters", null);
+ messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getPartName(), null);
}
messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
WSDLSerializationUtil.getPrefix(schemaElementName.getNamespaceURI(), axisService.getNameSpacesMap()) + ":"
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?view=diff&rev=549110&r1=549109&r2=549110
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Wed Jun 20 06:58:09 2007
@@ -1,49 +1,21 @@
package org.apache.axis2.description.java2wsdl;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaComplexContent;
-import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaImport;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaType;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.utils.NamespaceMap;
-import org.apache.ws.commons.schema.utils.NamespacePrefixList;
-import org.apache.axis2.description.java2wsdl.bytecode.MethodTable;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.AnnotationConstants;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.java2wsdl.bytecode.MethodTable;
+import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codehaus.jam.JAnnotation;
-import org.codehaus.jam.JClass;
-import org.codehaus.jam.JField;
-import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JPackage;
-import org.codehaus.jam.JParameter;
-import org.codehaus.jam.JProperty;
-import org.codehaus.jam.JamClassIterator;
-import org.codehaus.jam.JamService;
-import org.codehaus.jam.JamServiceFactory;
-import org.codehaus.jam.JamServiceParams;
+import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.ws.commons.schema.utils.NamespacePrefixList;
+import org.codehaus.jam.*;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.Iterator;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -79,39 +51,40 @@
protected ClassLoader classLoader;
- private String className;
+ protected String className;
protected TypeTable typeTable = new TypeTable();
// to keep loadded method using JAM
- private JMethod methods[];
+ protected JMethod methods[];
//to store byte code method using Axis 1.x codes
- private MethodTable methodTable;
+ protected MethodTable methodTable;
- private String schemaTargetNameSpace;
+ protected String schemaTargetNameSpace;
- private String schema_namespace_prefix;
+ protected String schema_namespace_prefix;
- private String attrFormDefault = null;
+ protected String attrFormDefault = null;
- private String elementFormDefault = null;
+ protected String elementFormDefault = null;
- private ArrayList excludeMethods = new ArrayList();
+ protected ArrayList excludeMethods = new ArrayList();
protected ArrayList extraClasses = null;
- private boolean useWSDLTypesNamespace = false;
+ protected boolean useWSDLTypesNamespace = false;
protected Map pkg2nsmap = null;
- private NamespaceGenerator nsGen = null;
+ protected NamespaceGenerator nsGen = null;
- private String targetNamespace = null;
+ protected String targetNamespace = null;
//to keep the list of operation which uses MR other than RPC MR
- private ArrayList nonRpcMethods = new ArrayList();
+ protected ArrayList nonRpcMethods = new ArrayList();
protected Class serviceClass = null;
+ protected AxisService service;
public NamespaceGenerator getNsGen() throws Exception {
if (nsGen == null) {
@@ -125,11 +98,13 @@
}
public DefaultSchemaGenerator(ClassLoader loader, String className,
- String schematargetNamespace,
- String schematargetNamespacePrefix)
+ String schematargetNamespace,
+ String schematargetNamespacePrefix,
+ AxisService service)
throws Exception {
this.classLoader = loader;
this.className = className;
+ this.service = service;
serviceClass = Class.forName(className, true, loader);
methodTable = new MethodTable(serviceClass);
@@ -171,14 +146,14 @@
jam_service_parms.includeClass(className);
for (int count = 0; count < getExtraClasses().size(); ++count) {
- jam_service_parms.includeClass((String)getExtraClasses().get(count));
+ jam_service_parms.includeClass((String) getExtraClasses().get(count));
}
JamService service = factory.createService(jam_service_parms);
QName extraSchemaTypeName;
JamClassIterator jClassIter = service.getClasses();
//all most all the time the ittr will have only one class in it
while (jClassIter.hasNext()) {
- JClass jclass = (JClass)jClassIter.next();
+ JClass jclass = (JClass) jClassIter.next();
if (getQualifiedName(jclass).equals(className)) {
/**
* Schema genertaion done in two stage 1. Load all the methods and
@@ -209,7 +184,7 @@
return schemaMap.values();
}
- private JMethod[] processMethods(JMethod[] declaredMethods) throws Exception {
+ protected JMethod[] processMethods(JMethod[] declaredMethods) throws Exception {
ArrayList list = new ArrayList();
//short the elements in the array
Arrays.sort(declaredMethods);
@@ -230,11 +205,11 @@
String methodName = getSimpleName(jMethod);
// no need to think abt this method , since that is system
// config method
- if (excludeMethods.contains(getSimpleName(jMethod))) {
+ if (excludeMethods.contains(methodName)) {
continue;
}
- if (uniqueMethods.get(getSimpleName(jMethod)) != null) {
+ if (uniqueMethods.get(methodName) != null) {
log.warn("We don't support method overloading. Ignoring [" +
jMethod.getQualifiedName() + "]");
continue;
@@ -244,35 +219,56 @@
// no need to generate Schema for non public methods
continue;
}
-
+ boolean addToService = false;
+ AxisOperation axisOperation = service.getOperation(new QName(methodName));
+ if (axisOperation == null) {
+ axisOperation = Utils.getAxisOperationForJmethod(jMethod);
+ addToService = true;
+ }
// Maintain a list of methods we actually work with
list.add(jMethod);
if (jMethod.getExceptionTypes().length > 0) {
- JClass[] extypes = jMethod.getExceptionTypes() ;
- for (int j= 0 ; j < extypes.length ; j++) {
- JClass extype = extypes[j] ;
- if(AxisFault.class.getName().equals(extype.getQualifiedName())){
+ JClass[] extypes = jMethod.getExceptionTypes();
+ for (int j = 0; j < extypes.length; j++) {
+ JClass extype = extypes[j];
+ if (AxisFault.class.getName().equals(extype.getQualifiedName())) {
continue;
}
- methodSchemaType = createSchemaTypeForMethodPart(extype.getSimpleName()+ "Fault");
+ String partQname = extype.getSimpleName() + "Fault";
+ methodSchemaType = createSchemaTypeForMethodPart(partQname);
sequence = new XmlSchemaSequence();
generateSchemaForType(sequence, extype, extype.getSimpleName());
methodSchemaType.setParticle(sequence);
+ if (AxisFault.class.getName().equals(extype.getQualifiedName())) {
+ continue;
+ }
+ AxisMessage faultMessage = new AxisMessage();
+ if (extypes.length > 1) {
+ faultMessage.setName(methodName + "Fault" + j);
+ } else {
+ faultMessage.setName(methodName + "Fault");
+ }
+ faultMessage.setElementQName(typeTable.getQNamefortheType(partQname));
+ axisOperation.setFaultMessages(faultMessage);
}
}
- uniqueMethods.put(getSimpleName(jMethod), jMethod);
- //create the schema type for the method wrapper
-
- uniqueMethods.put(getSimpleName(jMethod), jMethod);
+ uniqueMethods.put(methodName, jMethod);
JParameter[] paras = jMethod.getParameters();
String parameterNames[] = null;
+ AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (inMessage != null) {
+ inMessage.setName(methodName + Java2WSDLConstants.MESSAGE_SUFFIX);
+ }
if (paras.length > 0) {
parameterNames = methodTable.getParameterNames(methodName);
sequence = new XmlSchemaSequence();
- methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod));
+ methodSchemaType = createSchemaTypeForMethodPart(methodName);
methodSchemaType.setParticle(sequence);
+ inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
+ service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
+ axisOperation);
}
for (int j = 0; j < paras.length; j++) {
@@ -300,8 +296,9 @@
JClass returnType = jMethod.getReturnType();
if (!returnType.isVoidType()) {
+ String partQname = methodName + RESPONSE;
methodSchemaType =
- createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESPONSE);
+ createSchemaTypeForMethodPart(partQname);
sequence = new XmlSchemaSequence();
methodSchemaType.setParticle(sequence);
JAnnotation returnAnnon =
@@ -318,7 +315,15 @@
} else {
generateSchemaForType(sequence, returnType, returnName);
}
-
+ AxisMessage outMessage = axisOperation.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ outMessage.setElementQName(typeTable.getQNamefortheType(partQname));
+ outMessage.setName(partQname);
+ service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
+ axisOperation);
+ }
+ if (addToService) {
+ service.addOperation(axisOperation);
}
}
return (JMethod[]) list.toArray(new JMethod[list.size()]);
@@ -343,7 +348,7 @@
/**
* Generate schema construct for given type
- *
+ *
* @param javaType
*/
private QName generateSchema(JClass javaType) throws Exception {
@@ -356,10 +361,10 @@
String targetNameSpace = resolveSchemaNamespace(packageName);
XmlSchema xmlSchema = getXmlSchema(targetNameSpace);
- String targetNamespacePrefix = (String)targetNamespacePrefixMap.get(targetNameSpace);
+ String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace);
if (targetNamespacePrefix == null) {
targetNamespacePrefix = generatePrefix();
- targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix) ;
+ targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix);
}
XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
@@ -374,8 +379,8 @@
JClass sup = javaType.getSuperclass();
- if ((sup != null) && !( "java.lang.Object".compareTo(sup.getQualifiedName()) == 0) &&
- !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) {
+ if ((sup != null) && !("java.lang.Object".compareTo(sup.getQualifiedName()) == 0) &&
+ !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) {
String superClassName = sup.getQualifiedName();
String superclassname = getSimpleName(sup);
String tgtNamespace;
@@ -387,16 +392,16 @@
} else {
tgtNamespace =
resolveSchemaNamespace(sup.getContainingPackage().getQualifiedName());
- tgtNamespacepfx = (String)targetNamespacePrefixMap.get(tgtNamespace);
+ tgtNamespacepfx = (String) targetNamespacePrefixMap.get(tgtNamespace);
generateSchema(sup);
}
if (tgtNamespacepfx == null) {
tgtNamespacepfx = generatePrefix();
- targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx) ;
+ targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx);
}
- QName basetype = new QName(tgtNamespace,superclassname,tgtNamespacepfx) ;
+ QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx);
complexExtension.setBaseTypeName(basetype);
@@ -423,7 +428,7 @@
// adding this type to the table
typeTable.addComplexSchema(name, eltOuter.getQName());
- // adding this type's package to the table, to support inheritance.
+ // adding this type's package to the table, to support inheritance.
typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(),
eltOuter.getQName());
@@ -436,7 +441,7 @@
propertiesSet.add(tempProperties[i]);
}
- JProperty[] properties = (JProperty[])propertiesSet.toArray(new JProperty[0]);
+ JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]);
Arrays.sort(properties);
for (int i = 0; i < properties.length; i++) {
JProperty property = properties[i];
@@ -448,7 +453,7 @@
propertiesNames.add(propname);
this.generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getType(),
- propname, isArryType);
+ propname, isArryType);
}
@@ -484,7 +489,7 @@
}
// end patch for Annogen -21
- JField[] froperties = (JField[])FieldMap.values().toArray(new JField[0]);
+ JField[] froperties = (JField[]) FieldMap.values().toArray(new JField[0]);
Arrays.sort(froperties);
for (int i = 0; i < froperties.length; i++) {
@@ -493,7 +498,7 @@
boolean isArryType = field.getType().isArrayType();
this.generateSchemaforFieldsandProperties(xmlSchema, sequence, field.getType(),
- field.getSimpleName(), isArryType);
+ field.getSimpleName(), isArryType);
}
@@ -503,9 +508,9 @@
// moved code common to Fields & properties out of above method
- private void generateSchemaforFieldsandProperties(XmlSchema xmlSchema,
- XmlSchemaSequence sequence, JClass type,
- String name, boolean isArryType)
+ protected void generateSchemaforFieldsandProperties(XmlSchema xmlSchema,
+ XmlSchemaSequence sequence, JClass type,
+ String name, boolean isArryType)
throws Exception {
String propertyName;
@@ -525,12 +530,12 @@
elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
sequence.getItems().add(elt1);
- if (isArryType && (!propertyName.equals("base64Binary"))){
+ if (isArryType && (!propertyName.equals("base64Binary"))) {
elt1.setMaxOccurs(Long.MAX_VALUE);
}
- elt1.setMinOccurs(0) ;
- if(type.isPrimitiveType() == false) {
- elt1.setNillable(true) ;
+ elt1.setMinOccurs(0);
+ if (!type.isPrimitiveType()) {
+ elt1.setNillable(true);
}
} else {
if (isArryType) {
@@ -548,15 +553,15 @@
elt1.setMinOccurs(0);
elt1.setNillable(true);
- if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().
+ if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().
contains(typeTable.getComplexSchemaType(propertyName).getNamespaceURI())) {
XmlSchemaImport importElement = new XmlSchemaImport();
importElement.setNamespace(
typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
xmlSchema.getItems().add(importElement);
- ((NamespaceMap)xmlSchema.getNamespaceContext()).
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(),
- typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
+ typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
}
}
@@ -574,7 +579,7 @@
if (isArrayType) {
type = type.getArrayComponentType();
}
- if(AxisFault.class.getName().equals(type)){
+ if (AxisFault.class.getName().equals(type)) {
return null;
}
String classTypeName;
@@ -594,31 +599,33 @@
if (schemaTypeName == null) {
schemaTypeName = generateSchema(type);
addContentToMethodSchemaType(sequence,
- schemaTypeName,
- partName,
- isArrayType);
+ schemaTypeName,
+ partName,
+ isArrayType);
String schemaNamespace;
schemaNamespace = resolveSchemaNamespace(getQualifiedName(type.getContainingPackage()));
addImport(getXmlSchema(schemaNamespace), schemaTypeName);
} else {
addContentToMethodSchemaType(sequence,
- schemaTypeName,
- partName,
- isArrayType);
+ schemaTypeName,
+ partName,
+ isArrayType);
}
return schemaTypeName;
}
- private void addContentToMethodSchemaType(XmlSchemaSequence sequence,
- QName schemaTypeName,
- String paraName,
- boolean isArray) {
+ protected void addContentToMethodSchemaType(XmlSchemaSequence sequence,
+ QName schemaTypeName,
+ String paraName,
+ boolean isArray) {
XmlSchemaElement elt1 = new XmlSchemaElement();
elt1.setName(paraName);
elt1.setSchemaTypeName(schemaTypeName);
- sequence.getItems().add(elt1);
+ if (sequence != null) {
+ sequence.getItems().add(elt1);
+ }
if (isArray) {
elt1.setMaxOccurs(Long.MAX_VALUE);
@@ -633,9 +640,9 @@
new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix);
XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName);
- if(complexType == null) {
+ if (complexType == null) {
complexType = new XmlSchemaComplexType(xmlSchema);
-
+
XmlSchemaElement globalElement = new XmlSchemaElement();
globalElement.setSchemaType(complexType);
globalElement.setName(localPartName);
@@ -648,12 +655,12 @@
return complexType;
}
- private XmlSchemaComplexType getComplexTypeForElement(XmlSchema xmlSchema, QName name) {
+ protected XmlSchemaComplexType getComplexTypeForElement(XmlSchema xmlSchema, QName name) {
Iterator iterator = xmlSchema.getItems().getIterator();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
XmlSchemaObject object = (XmlSchemaObject) iterator.next();
- if(object instanceof XmlSchemaElement && ((XmlSchemaElement)object).getQName().equals(name)){
- return (XmlSchemaComplexType)((XmlSchemaElement)object).getSchemaType();
+ if (object instanceof XmlSchemaElement && ((XmlSchemaElement) object).getQName().equals(name)) {
+ return (XmlSchemaComplexType) ((XmlSchemaElement) object).getSchemaType();
}
}
return null;
@@ -662,7 +669,7 @@
private XmlSchema getXmlSchema(String targetNamespace) {
XmlSchema xmlSchema;
- if ((xmlSchema = (XmlSchema)schemaMap.get(targetNamespace)) == null) {
+ if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) {
String targetNamespacePrefix = null;
if (targetNamespace.equals(schemaTargetNameSpace) &&
@@ -698,7 +705,7 @@
return methods;
}
- private String generatePrefix() {
+ protected String generatePrefix() {
return NAME_SPACE_PREFIX + prefixCount++;
}
@@ -711,14 +718,14 @@
return schemaTargetNameSpace;
}
- private void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
+ protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
NamespacePrefixList map = xmlSchema.getNamespaceContext();
- if (map instanceof NamespaceMap && !((NamespaceMap)map).values().
+ if (map instanceof NamespaceMap && !((NamespaceMap) map).values().
contains(schemaTypeName.getNamespaceURI())) {
XmlSchemaImport importElement = new XmlSchemaImport();
importElement.setNamespace(schemaTypeName.getNamespaceURI());
xmlSchema.getItems().add(importElement);
- ((NamespaceMap)xmlSchema.getNamespaceContext()).
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(), schemaTypeName.getNamespaceURI());
}
}
@@ -739,7 +746,7 @@
this.elementFormDefault = elementFormDefault;
}
- private XmlSchemaForm getAttrFormDefaultSetting() {
+ protected XmlSchemaForm getAttrFormDefaultSetting() {
if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) {
return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
} else {
@@ -747,7 +754,7 @@
}
}
- private XmlSchemaForm getElementFormDefaultSetting() {
+ protected XmlSchemaForm getElementFormDefaultSetting() {
if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) {
return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
} else {
@@ -766,17 +773,17 @@
this.extraClasses = extraClasses;
}
- private String resolveSchemaNamespace(String packageName) throws Exception {
+ protected String resolveSchemaNamespace(String packageName) throws Exception {
//if all types must go into the wsdl types schema namespace
if (useWSDLTypesNamespace) {
//return schemaTargetNameSpace;
- return (String)pkg2nsmap.get("all");
+ return (String) pkg2nsmap.get("all");
} else {
if (pkg2nsmap != null && !pkg2nsmap.isEmpty()) {
//if types should go into namespaces that are mapped against the package name for the type
if (pkg2nsmap.get(packageName) != null) {
//return that mapping
- return (String)pkg2nsmap.get(packageName);
+ return (String) pkg2nsmap.get(packageName);
} else {
return getNsGen().schemaNamespaceFromPackageName(packageName).toString();
}
@@ -847,5 +854,9 @@
if (nonRpcMethods != null) {
this.nonRpcMethods = nonRpcMethods;
}
+ }
+
+ public void setAxisService(AxisService service) {
+ this.service = service;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org