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 2005/08/31 12:11:43 UTC
svn commit: r264999 - in /webservices/axis2/trunk/java/modules/wsdl:
project.xml
src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
Author: ajith
Date: Wed Aug 31 03:11:35 2005
New Revision: 264999
URL: http://svn.apache.org/viewcvs?rev=264999&view=rev
Log:
Correcting the third party schema problem. Now the code generator loads several third party schemas (the xmlmime schema ATM) at code generation. A possible improvement for the future would be to pump these third party schemas only when required.
The build file is updated to add xsd's as resources.
Modified:
webservices/axis2/trunk/java/modules/wsdl/project.xml
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
Modified: webservices/axis2/trunk/java/modules/wsdl/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/project.xml?rev=264999&r1=264998&r2=264999&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/project.xml (original)
+++ webservices/axis2/trunk/java/modules/wsdl/project.xml Wed Aug 31 03:11:35 2005
@@ -17,92 +17,102 @@
*/
-->
<project>
- <pomVersion>3</pomVersion>
- <extend>../../etc/project.xml</extend>
-
- <name>Apache Axis 2.0 - WSDL</name>
- <id>axis2-wsdl</id>
- <groupId>axis2</groupId>
- <description>WSDL support for Axis 2.0. This includes WSDL Object Model built based on the proposed WSDL 2.0 Component Model.</description>
-
- <dependencies>
- <dependency>
- <groupId>axis2</groupId>
- <artifactId>axis2-xml</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis2</groupId>
- <artifactId>axis2-common</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>0.9</version>
- </dependency>
-
- <!-- external JARs -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- <properties>
- <module>true</module>
- </properties>
- <url>http://dist.codehaus.org/stax/jars/</url>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax</artifactId>
- <version>1.1.1-dev</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis-wsdl4j</artifactId>
- <version>1.2</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- <version>2.0.0-beta1</version>
- <type>jar</type>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.6.2</version>
- <type>jar</type>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- </dependencies>
-
- <reports/>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+ <name>Apache Axis 2.0 - WSDL</name>
+ <id>axis2-wsdl</id>
+ <groupId>axis2</groupId>
+ <description>WSDL support for Axis 2.0. This includes WSDL Object Model built based on the proposed WSDL 2.0 Component Model.</description>
+ <dependencies>
+ <dependency>
+ <groupId>axis2</groupId>
+ <artifactId>axis2-xml</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis2</groupId>
+ <artifactId>axis2-common</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>0.9</version>
+ </dependency>
+ <!-- external JARs -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.8</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>1.1.1-dev</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-wsdl4j</artifactId>
+ <version>1.2</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.0.0-beta1</version>
+ <type>jar</type>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.2</version>
+ <type>jar</type>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ </dependencies>
+ <!-- add the build properties-->
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.xsl</include>
+ <include>**/*.xsd</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <reports/>
</project>
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java?rev=264999&r1=264998&r2=264999&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java Wed Aug 31 03:11:35 2005
@@ -14,6 +14,7 @@
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
import java.io.*;
import java.util.*;
@@ -55,10 +56,6 @@
Element[] additionalSchemas = loadAdditionalSchemas();
- //test whether the TCCL has the Xbeans classes
- //ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
-
try {
//get the types from the types section
WSDLTypes typesList = configuration.getWom().getTypes();
@@ -75,21 +72,10 @@
List typesArray = typesList.getExtensibilityElements();
WSDLExtensibilityElement extensiblityElt;
SchemaTypeSystem sts;
- //Vector schemabaseURIList=new Vector();
Vector xmlObjectsVector= new Vector();
- //String schemaBaseURI ;
-
//create the type mapper
JavaTypeMapper mapper = new JavaTypeMapper();
- // run the third party schemas
-// for (int i = 0; i < additionalSchemas.length; i++) {
-// System.out.println(additionalSchemas[i]);
-// xmlObjectsVector.add(XmlObject.Factory.parse(
-// additionalSchemas[i]
-// ,null));
-// }
-
for (int i = 0; i < typesArray.size(); i++) {
extensiblityElt = (WSDLExtensibilityElement) typesArray.get(i);
Schema schema;
@@ -99,7 +85,7 @@
XmlOptions options = new XmlOptions();
options.setLoadAdditionalNamespaces(
configuration.getWom().getNamespaces()); //add the namespaces
- // options.
+
Stack importedSchemaStack = schema.getImportedSchemaStack();
//compile these schemas
@@ -118,7 +104,14 @@
}
+ // add the third party schemas
+ for (int i = 0; i < additionalSchemas.length; i++) {
+ xmlObjectsVector.add(XmlObject.Factory.parse(
+ additionalSchemas[i]
+ ,null));
+ }
+ //compile the type system
sts = XmlBeans.compileXmlBeans(DEFAULT_STS_NAME, null,
convertToXMLObjectArray(xmlObjectsVector),
new BindingConfig(), XmlBeans.getContextTypeLoader(),
@@ -140,6 +133,11 @@
}
+ /**
+ * Loading the external schemas.
+ * @return element array consisting of the the DOM element objects that represent schemas
+ *
+ */
private Element[] loadAdditionalSchemas() {
//load additional schemas
String[] schemaNames = ConfigPropertyFileLoader.getThirdPartySchemaNames();
@@ -149,7 +147,10 @@
ArrayList additionalSchemaElements = new ArrayList();
for (int i = 0; i < schemaNames.length; i++) {
InputStream schemaStream = this.getClass().getResourceAsStream("/org/apache/axis2/wsdl/codegen/schema/"+ schemaNames[i]);
- Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(schemaStream);
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ Document doc = documentBuilder.parse(schemaStream);
additionalSchemaElements.add(doc.getDocumentElement());
}