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/04/21 18:18:39 UTC
svn commit: r395927 [3/3] - in /webservices/axis2/trunk/java/modules:
codegen/src/org/apache/axis2/schema/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
core/src/org/apache/axis2/description/
xmlbeans/src/org/apache/axis2/xmlbeans/
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?rev=395927&r1=395926&r2=395927&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Fri Apr 21 09:18:36 2006
@@ -48,12 +48,14 @@
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+import com.ibm.wsdl.util.xml.DOM2Writer;
/**
* Framework-linked code used by XMLBeans data binding support. This is accessed
* via reflection from the XMLBeans code generation extension when XMLBeans data
* binding is selected.
- *
+ *
* @author dsosnoski
*/
public class CodeGenerationUtility {
@@ -71,15 +73,15 @@
boolean debug = false;
/**
- *
+ *
* @param additionalSchemas
* @throws RuntimeException
*/
public static TypeMapper processSchemas(List schemas,
- Element[] additionalSchemas, CodeGenConfiguration cgconfig) throws RuntimeException {
+ Element[] additionalSchemas, CodeGenConfiguration cgconfig) throws RuntimeException {
try {
-
-
+
+
//check for the imported types. Any imported types are supposed to be here also
if (schemas == null || schemas.isEmpty()) {
//there are no types to be code generated
@@ -97,17 +99,22 @@
JavaTypeMapper mapper = new JavaTypeMapper();
Map nameSpacesMap = cgconfig.getAxisService().getNameSpacesMap();
for (int i = 0; i < schemas.size(); i++) {
-
XmlSchema schema = (XmlSchema) schemas.get(i);
XmlOptions options = new XmlOptions();
-
options.setLoadAdditionalNamespaces(
nameSpacesMap); //add the namespaces
- xmlObjectsVector.add(
- XmlObject.Factory.parse(
- getSchemaAsString(schema)
- , options));
+ Document[] allSchemas = schema.getAllSchemas();
+ for (int j = 0; j < allSchemas.length; j++) {
+ Document allSchema = allSchemas[j];
+ ///////////////////////////
+ //System.out.println(DOM2Writer.nodeToString(allSchema));
+ ////////////////////////////
+ xmlObjectsVector.add(
+ XmlObject.Factory.parse(
+ allSchema
+ , options));
+ }
}
// add the third party schemas
@@ -135,9 +142,9 @@
// prune the generated schema type system and add the list of base64 types
cgconfig.putProperty(XSLTConstants.BASE_64_PROPERTY_KEY,
- findBase64Types(sts));
+ findBase64Types(sts));
cgconfig.putProperty(XSLTConstants.PLAIN_BASE_64_PROPERTY_KEY,
- findPlainBase64Types(sts));
+ findPlainBase64Types(sts));
//get the schematypes and add the document types to the type mapper
SchemaType[] schemaType = sts.documentTypes();
@@ -147,7 +154,7 @@
mapper.addTypeMappingName(type.getDocumentElementName(),
type.getFullJavaName());
}
-
+
//return mapper to be set in the config
return mapper;
@@ -157,6 +164,7 @@
}
}
+
/**
* Populate the base64 types
* The algo is to look for simpletypes that have base64 content, and then step out of that
@@ -238,9 +246,9 @@
* Private class to generate the filer
*/
private static class Axis2Filer implements Filer {
-
+
private File location;
-
+
private Axis2Filer(File loc) {
location = loc;
}
@@ -304,7 +312,7 @@
if (uri2packageMappings.containsKey(uri)){
return (String)uri2packageMappings.get(uri);
}else{
- return URLProcessor.makePackageName(uri);
+ return URLProcessor.makePackageName(uri);
}
}