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/01/03 08:52:50 UTC
svn commit: r365564 - in /webservices/axis2/trunk/java:
modules/codegen/src/org/apache/axis2/schema/
modules/codegen/src/org/apache/axis2/schema/writer/
modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/
modules/wsdl/src/org/apache/axis2/wsdl...
Author: ajith
Date: Mon Jan 2 23:52:25 2006
New Revision: 365564
URL: http://svn.apache.org/viewcvs?rev=365564&view=rev
Log:
1. Added the patch from Sanka. The changes added better support for Policy extensibility elements
2. Added an exception to the schema generator
3. Fixed a bug introduced by the package name change
4. Updated the ant task documentation
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
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/extension/SimpleDBExtension.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/writer/WOMtoWSDL11Writer.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/ExtensionConstants.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/PolicyExtensibilityElement.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/PolicyExtensitbilityElementImpl.java
webservices/axis2/trunk/java/xdocs/CodegenToolReference.html
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java Mon Jan 2 23:52:25 2006
@@ -148,7 +148,6 @@
/**
* Compile (rather codegen) a single schema element
- *
* @param schema
* @throws SchemaCompilationException
*/
@@ -428,6 +427,12 @@
XmlSchemaAnyAttribute anyAtt = complexType.getAnyAttribute();
if (anyAtt != null) {
processAnyAttribute(metaInfHolder);
+ }
+
+
+ if (complexType.getContentModel()!=null){
+ //for the time being we cannot deal with these content. so throw an exception
+ throw new RuntimeException("Unsupported content! ");
}
// Process the other types - Say the complex content, extensions and so on
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java Mon Jan 2 23:52:25 2006
@@ -97,7 +97,6 @@
public static final String WRAP_SCHEMA_CLASSES = "w";
public static final String WRITE_SCHEMA_CLASSES = "r";
-
public static final String STYLE = "s";
}
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=365564&r1=365563&r2=365564&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 Mon Jan 2 23:52:25 2006
@@ -108,8 +108,11 @@
globalWrappedDocument.appendChild(rootElement);
XSLTUtils.addAttribute(globalWrappedDocument, "name", WRAPPED_DATABINDING_CLASS_NAME, rootElement);
String tempPackageName = null;
- if (packageName.endsWith(".")) {
+
+ if (packageName !=null && packageName.endsWith(".")) {
tempPackageName = this.packageName.substring(0, this.packageName.lastIndexOf("."));
+ }else{
+ tempPackageName = "adb"; //todo - fix this
}
XSLTUtils.addAttribute(globalWrappedDocument, "package", tempPackageName, 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=365564&r1=365563&r2=365564&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 Mon Jan 2 23:52:25 2006
@@ -183,6 +183,7 @@
if(!outputDir.exists()) {
outputDir.mkdirs();
}
+
/// these options need to be taken from the command line
options.setOutputLocation(outputDir);
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java Mon Jan 2 23:52:25 2006
@@ -18,10 +18,14 @@
import com.ibm.wsdl.extensions.soap.SOAPConstants;
import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
+import org.apache.ws.policy.util.DOMPolicyReader;
+import org.apache.ws.policy.util.OMPolicyReader;
+import org.apache.ws.policy.util.PolicyFactory;
import org.apache.wsdl.*;
import org.apache.wsdl.extensions.DefaultExtensibilityElement;
import org.apache.wsdl.extensions.ExtensionConstants;
import org.apache.wsdl.extensions.ExtensionFactory;
+import org.apache.wsdl.extensions.PolicyExtensibilityElement;
import org.apache.wsdl.impl.WSDLProcessingException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -1035,6 +1039,19 @@
Element element = unknown.getElement();
soapAddressExtensibiltyElement.setLocationURI(element.getAttribute("location"));
component.addExtensibilityElement(soapAddressExtensibiltyElement);
+
+ } else if (ExtensionConstants.POLICY.equals(unknown.getElementType())) {
+ PolicyExtensibilityElement policyExtensibilityElement = (PolicyExtensibilityElement) extensionFactory.getExtensionElement(wsdl4jElement.getElementType());
+ DOMPolicyReader policyReader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ policyExtensibilityElement.setPolicyElement(policyReader.readPolicy(unknown.getElement()));
+ component.addExtensibilityElement(policyExtensibilityElement);
+
+ } else if (ExtensionConstants.POLICY_REFERENCE.equals(unknown.getElementType())) {
+ PolicyExtensibilityElement policyExtensibilityElement = (PolicyExtensibilityElement) extensionFactory.getExtensionElement(wsdl4jElement.getElementType());
+ DOMPolicyReader policyReader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ policyExtensibilityElement.setPolicyElement(policyReader.readPolicyReference(unknown.getElement()));
+ component.addExtensibilityElement(policyExtensibilityElement);
+
}else{
DefaultExtensibilityElement defaultExtensibilityElement = (DefaultExtensibilityElement) extensionFactory
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/writer/WOMtoWSDL11Writer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/writer/WOMtoWSDL11Writer.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/writer/WOMtoWSDL11Writer.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/writer/WOMtoWSDL11Writer.java Mon Jan 2 23:52:25 2006
@@ -6,6 +6,10 @@
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis2.wsdl.WSDLVersionWrapper;
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PolicyReference;
+import org.apache.ws.policy.util.PolicyFactory;
+import org.apache.ws.policy.util.StAXPolicyWriter;
import org.apache.wsdl.*;
import org.apache.wsdl.extensions.*;
import org.w3c.dom.Element;
@@ -15,6 +19,7 @@
import javax.wsdl.xml.WSDLWriter;
import javax.xml.namespace.QName;
import javax.xml.stream.*;
+
import java.io.*;
import java.util.HashMap;
import java.util.Iterator;
@@ -120,7 +125,10 @@
findSOAPNsPrefix(wsdlDescription);
//write the imports
writeImports(wsdlDescription);
- //write the types
+ //write extensibility elements
+ handleExtensibiltyElements(wsdlDescription.getExtensibilityElements());
+
+ //write the types
writeTypes(wsdlDescription);
//write the messages
writeMessages(wsdlDescription);
@@ -155,6 +163,7 @@
service = (WSDLService) serviceIterator.next();
writer.writeStartElement(defaultWSDLPrefix, "service", WSDL1_1_NAMESPACE_URI);
writer.writeAttribute("name", service.getName().getLocalPart());
+ handleExtensibiltyElements(service.getExtensibilityElements());
//wrtie the porttypes
Map endPointMap = service.getEndpoints();
if (endPointMap != null && !endPointMap.isEmpty()) {
@@ -410,8 +419,10 @@
/**
* @param desc
+ * @throws XMLStreamException
+ * @throws IOException
*/
- protected void writePortTypes(WSDLDescription desc) throws XMLStreamException {
+ protected void writePortTypes(WSDLDescription desc) throws XMLStreamException, IOException {
Map interfaceMap = desc.getWsdlInterfaces();
if (!interfaceMap.isEmpty()) {
Iterator interfaceIterator = interfaceMap.values().iterator();
@@ -421,7 +432,8 @@
writer.writeStartElement(defaultWSDLPrefix, PORTTYPE_NAME, WSDL1_1_NAMESPACE_URI);
writer.writeAttribute("name",
wsdlInterface.getName() == null ? "" : wsdlInterface.getName().getLocalPart());
-
+ //write extensibility attributes
+ handleExtensibilityAttributes(wsdlInterface.getExtensibilityAttributes());
//write the operations
writePorttypeOperations(wsdlInterface);
@@ -437,8 +449,10 @@
* Writes the operation.
*
* @param wsdlInterface
+ * @throws XMLStreamException
+ * @throws IOException
*/
- protected void writePorttypeOperations(WSDLInterface wsdlInterface) throws XMLStreamException {
+ protected void writePorttypeOperations(WSDLInterface wsdlInterface) throws XMLStreamException, IOException {
Map operationsMap = wsdlInterface.getOperations();
if (!operationsMap.isEmpty()) {
Iterator opIterator = operationsMap.values().iterator();
@@ -449,12 +463,16 @@
writer.writeAttribute("name", operation.getName() == null ? "" : operation.getName().getLocalPart());
// writer.writeEndElement();
//write the inputs
+ //write extensibility elements
+ handleExtensibiltyElements(operation.getExtensibilityElements());
WSDL11Message message;
MessageReference inputMessage = operation.getInputMessage();
if (inputMessage != null) {
message = (WSDL11Message) messageMap.get(inputMessage.getElementQName());
writer.writeStartElement(defaultWSDLPrefix, INPUT_NAME, WSDL1_1_NAMESPACE_URI);
writer.writeAttribute("message", targetNamespacePrefix + ":" + message.getMessageName());
+ //write extensibility attributes
+ handleExtensibilityAttributes(inputMessage.getExtensibilityAttributes());
writer.writeEndElement();
}
@@ -464,6 +482,8 @@
message = (WSDL11Message) messageMap.get(outputMessage.getElementQName());
writer.writeStartElement(defaultWSDLPrefix, OUTPUT_NAME, WSDL1_1_NAMESPACE_URI);
writer.writeAttribute("message", targetNamespacePrefix + ":" + message.getMessageName());
+// write extensibility attributes
+ handleExtensibilityAttributes(outputMessage.getExtensibilityAttributes());
writer.writeEndElement();
}
@@ -525,12 +545,19 @@
WSDLBindingMessageReference output = bindingOp.getOutput();
if (output != null) {
writer.writeStartElement(defaultWSDLPrefix, BINDING_OUTPUT, WSDL1_1_NAMESPACE_URI);
- handleExtensibiltyElements(output.getExtensibilityElements());
+ handleExtensibiltyElements(output.getExtensibilityElements());
writer.writeEndElement();
}
writer.writeEndElement();
}
+ protected void handleExtensibilityAttributes(List extAttributeList) throws XMLStreamException {
+ int extAttributeCount = extAttributeList.size();
+ for (int i = 0; i < extAttributeCount; i++) {
+ writeExtensibilityAttribute((WSDLExtensibilityAttribute) extAttributeList.get(i));
+ }
+ }
+
protected void handleExtensibiltyElements(List extElementList) throws XMLStreamException, IOException {
int extensibilityElementCount = extElementList.size();
for (int i = 0; i < extensibilityElementCount; i++) {
@@ -551,6 +578,13 @@
OMElement scheamElement = staxOMBuilder.getDocumentElement();
scheamElement.serialize(writer);
}
+
+ protected void writeExtensibilityAttribute(WSDLExtensibilityAttribute extAttribute) throws XMLStreamException {
+ QName qname = extAttribute.getKey();
+ QName value = extAttribute.getValue();
+
+ writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), value.getLocalPart());
+ }
/**
* @param extElement
@@ -574,6 +608,8 @@
writeSOAPOpextensibilityElement((SOAPOperation) extElement);
} else if (extElement instanceof SOAPBody) {
writeSOAPBodyExtensibilityElement((SOAPBody) extElement);
+ } else if (extElement instanceof PolicyExtensibilityElement) {
+ writePolicyExtensibilityElement((PolicyExtensibilityElement) extElement);
} else {
writer.writeComment(" Unknown extensibility element" + extElement.toString());
}
@@ -615,6 +651,18 @@
writer.writeAttribute("soapAction", soapop.getSoapAction());
writer.writeAttribute("style", soapop.getStyle());
writer.writeEndElement();
+ }
+
+ protected void writePolicyExtensibilityElement(PolicyExtensibilityElement policyExtensibilityElement) throws XMLStreamException {
+ StAXPolicyWriter policyWriter = (StAXPolicyWriter) PolicyFactory.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
+ Object policyElement = policyExtensibilityElement.getPolicyElement();
+
+ if (policyElement instanceof Policy) {
+ policyWriter.writePolicy((Policy) policyElement, writer);
+
+ } else if (policyElement instanceof PolicyReference) {
+ policyWriter.writePolicyReference((PolicyReference) policyElement, writer);
+ }
}
/**
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/ExtensionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/ExtensionConstants.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/ExtensionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/ExtensionConstants.java Mon Jan 2 23:52:25 2006
@@ -54,5 +54,6 @@
public static final QName POLICY = new QName(
"http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
-
+ public static final QName POLICY_REFERENCE = new QName(
+ "http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyReference");
}
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/PolicyExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/PolicyExtensibilityElement.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/PolicyExtensibilityElement.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/PolicyExtensibilityElement.java Mon Jan 2 23:52:25 2006
@@ -16,7 +16,6 @@
package org.apache.wsdl.extensions;
-import org.apache.ws.policy.Policy;
import org.apache.wsdl.WSDLExtensibilityElement;
/**
@@ -24,7 +23,7 @@
*/
public interface PolicyExtensibilityElement extends WSDLExtensibilityElement {
- public void setPolicy(Policy policy);
+ public void setPolicyElement(Object policyElement);
- public Policy getPolicy();
+ public Object getPolicyElement();
}
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/PolicyExtensitbilityElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/PolicyExtensitbilityElementImpl.java?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/PolicyExtensitbilityElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/PolicyExtensitbilityElementImpl.java Mon Jan 2 23:52:25 2006
@@ -24,20 +24,21 @@
* @author Sanka Samaranayake (sanka@apache.org)
*/
public class PolicyExtensitbilityElementImpl extends WSDLExtensibilityElementImpl implements PolicyExtensibilityElement {
- private Policy policy;
+ private Object policyElement;
public PolicyExtensitbilityElementImpl() {
}
- public PolicyExtensitbilityElementImpl(Policy policy) {
- setPolicy(policy);
+
+ public PolicyExtensitbilityElementImpl(Object policyElement) {
+ setPolicyElement(policyElement);
}
- public void setPolicy(Policy policy) {
- this.policy = policy;
+ public void setPolicyElement(Object policyElement) {
+ this.policyElement = policyElement;
}
- public Policy getPolicy() {
- return policy;
+ public Object getPolicyElement() {
+ return policyElement;
}
}
Modified: webservices/axis2/trunk/java/xdocs/CodegenToolReference.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/CodegenToolReference.html?rev=365564&r1=365563&r2=365564&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/CodegenToolReference.html (original)
+++ webservices/axis2/trunk/java/xdocs/CodegenToolReference.html Mon Jan 2 23:52:25 2006
@@ -36,8 +36,8 @@
<tr>
<td width="50%">-l <language></td>
<td width="50%">Output language. Currently the code generator can
- generate code in Java and CSharp. (CSharp support is limited) When
- omitted defaults to Java.
+ generate code in Java and CSharp. (CSharp support is experimental)
+ When omitted defaults to Java.
<p>Allowed options are</p>
<ul>
@@ -67,12 +67,7 @@
<tr>
<td width="50%">-t</td>
<td width="50%">Generates a test case. In the case of Java it would be
- a junit test case. This test case will generate a dummy
- implementation of the service and a relevant service.xml and will
- deploy this particular service in a SimpleHttpServer. Then looking at
- the WSDL it will generate test methods that will do web service
- invocation both synchronously and asynchronously and test the
- deployed service.</td>
+ a junit test case. </td>
</tr>
<tr>
<td width="50%">-ss</td>
@@ -82,12 +77,26 @@
<tr>
<td width="50%">-sd</td>
<td width="50%">Generates the service descriptor (i.e. server.xml).
- Default is off. only valid with -ss</td>
+ Default is off. only valid with -ss, the server side code generation
+ option</td>
</tr>
- <tr>
+ <tr>
<td width="50%">-d</td>
- <td width="50%">Specifies the Databinding framwork. valid values are xmlbeans,adb and none.
- Default is xmlbeans.
+ <td width="50%">Specifies the Databinding framework. valid values are
+ xmlbeans,adb and none. Default is adb.</td>
+ </tr>
+<tr>
+ <td width="50%">-g</td>
+ <td width="50%">Genrates all the classes. This option is valid only with the
+-ss (server side code generation) option. When on, the client code (stubs) will also be generated
+along with the skeleton.
+</td>
+ </tr>
+
+ <td width="50%">-u</td>
+ <td width="50%">
+Unwrap classes. This option specifies whether to unwrap the classes and generate seperate classes for
+the databinders.
</td>
</tr>
</tbody>
@@ -189,8 +198,7 @@
wsdlfilename="C:\test\wsdl\CombinedService.wsdl"
output="C:\"
serverside="true"
- generateserverxml="true"
-/>
+ generateserverxml="true"/>
</target>
</project></pre>
@@ -208,7 +216,7 @@
<p>For this Ant task to work the following jars need to be in the class
path.</p>
<ul>
- <li>axis-M2.jar (from the Axis2 distribution)</li>
+ <li>axis-*.jar (from the Axis2 distribution)</li>
<li>axis-wsdl4j-1.2.jar (The WSDL4J implementation jar. Bundled with the
Axis2 distribution)</li>
<li>stax-api-1.0.jar (The StAX API's that contain the
@@ -383,8 +391,7 @@
</java>
</target>
-</project>
-</pre>
+</project></pre>
<p>The above build.xml depends on a build.properties file which defines
'axis.home', such as:</p>
@@ -553,8 +560,7 @@
}
-}
-</pre>
+}</pre>
<p>The next steps assume the axis2.war has been deployed and has expanded in
a servlet container.</p>
@@ -627,7 +633,6 @@
}
}
}
-
</pre>
<p>Now run the ant task 'ant runLogin' . The following output should