Author: bimargulies Date: Sun Oct 17 02:30:38 2010 New Revision: 1023416 URL: http://svn.apache.org/viewvc?rev=1023416&view=rev Log: Respond to the removal of addType. Not all problems in CORBA fixed yet
Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ArrayVisitor.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceDeferredAction.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original) +++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Sun Oct 17 02:30:38 2010 @@ -478,23 +478,24 @@ class JAXBSchemaInitializer extends Serv schema = schemaInfo.getSchema(); } - XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, false); - ct.setName(part.getElementQName().getLocalPart()); // Before updating everything, make sure we haven't added this // type yet. Multiple methods that throw the same exception // types will cause duplicates. - if (schema.getTypeByName(ct.getQName()) != null) { + String partLocalName = part.getElementQName().getLocalPart(); + XmlSchemaType existingType = schema.getTypeByName(partLocalName); + if (existingType != null) { return; } + XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true); + ct.setName(partLocalName); + XmlSchemaElement el = new XmlSchemaElement(schema, true); - el.setName(part.getElementQName().getLocalPart()); + el.setName(partLocalName); part.setXmlSchema(el); - schema.getItems().add(ct); - schema.addType(ct); schemaInfo.setElement(null); - el.setSchemaTypeName(part.getElementQName()); + el.setSchemaTypeName(ct.getQName()); XmlSchemaSequence seq = new XmlSchemaSequence(); ct.setParticle(seq); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ArrayVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ArrayVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ArrayVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ArrayVisitor.java Sun Oct 17 02:30:38 2010 @@ -137,10 +137,6 @@ public class ArrayVisitor extends Visito } } - // add schemaType - schema.getItems().add(stype); - schema.addType(stype); - // add corbaType typeMap.getStructOrExceptionOrUnion().add(ctype); @@ -185,11 +181,6 @@ public class ArrayVisitor extends Visito getFullyQualifiedName())); } - - // add schemaType - schema.getItems().add(result.getSchemaType()); - schema.addType(result.getSchemaType()); - // add corbaType typeMap.getStructOrExceptionOrUnion().add(result.getCorbaType()); } @@ -199,7 +190,7 @@ public class ArrayVisitor extends Visito private XmlSchemaComplexType generateSchemaArray(Scope scopedName, Long size, XmlSchemaType type, Scope fQName) { - XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, false); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, true); complexType.setName(mapper.mapToQName(scopedName)); XmlSchemaSequence sequence = new XmlSchemaSequence(); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java Sun Oct 17 02:30:38 2010 @@ -67,13 +67,6 @@ public class DeclaratorVisitor extends V arrayVisitor.visit(node); } else { - // add schemaType - if ((getSchemaType() != null) - && (schemas.getTypeByQName(getSchemaType().getQName()) == null) - && (schema.getTypeByName(getSchemaType().getQName()) == null)) { - schema.getItems().add(getSchemaType()); - schema.addType(getSchemaType()); - } // add corbaType typeMap.getStructOrExceptionOrUnion().add(getCorbaType()); } @@ -162,16 +155,12 @@ public class DeclaratorVisitor extends V if (nextCorbaType != null) { typeMap.getStructOrExceptionOrUnion().add(nextCorbaType); } - if (nextSchemaType != null) { - schema.getItems().add(nextSchemaType); - schema.addType(nextSchemaType); - } } private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) { XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType(); - XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, false); + XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, true); newSchemaType.setName(newScope.toString()); newSchemaType.setParticle(oldSchemaType.getParticle()); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java Sun Oct 17 02:30:38 2010 @@ -80,7 +80,7 @@ public class ExceptionVisitor extends Vi String exceptionTypeName = exceptionName + TYPE_SUFFIX; - XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, false); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, true); complexType.setName(exceptionTypeName); //complexType.setQName(new QName(schema.getTargetNamespace(), exceptionTypeName)); XmlSchemaSequence sequence = new XmlSchemaSequence(); @@ -141,11 +141,6 @@ public class ExceptionVisitor extends Vi memberTypeNode = memberNode.getNextSibling(); } - schema.addType(complexType); - schema.getItems().add(element); - schema.getItems().add(complexType); - - // add exception to corba typemap typeMap.getStructOrExceptionOrUnion().add(exception); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java Sun Oct 17 02:30:38 2010 @@ -96,7 +96,7 @@ public class FixedVisitor extends Visito } // xmlschema:fixed - XmlSchemaSimpleType fixedSimpleType = new XmlSchemaSimpleType(schema, false); + XmlSchemaSimpleType fixedSimpleType = new XmlSchemaSimpleType(schema, true); XmlSchemaSimpleTypeRestriction fixedRestriction = new XmlSchemaSimpleTypeRestriction(); fixedRestriction.setBaseTypeName(Constants.XSD_DECIMAL); XmlSchemaTotalDigitsFacet fixedTotalDigits = new XmlSchemaTotalDigitsFacet(); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceDeferredAction.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceDeferredAction.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceDeferredAction.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceDeferredAction.java Sun Oct 17 02:30:38 2010 @@ -34,34 +34,34 @@ public class SequenceDeferredAction impl protected Sequence sequence; protected XmlSchemaElement element; protected XmlSchema schema; - protected XmlSchemaCollection schemas; - + protected XmlSchemaCollection schemas; + public SequenceDeferredAction(Sequence sequenceType, Anonsequence anonSequenceType, XmlSchemaElement elem) { anonSequence = anonSequenceType; sequence = sequenceType; - element = elem; + element = elem; } - + public SequenceDeferredAction(Anonsequence anonSequenceType) { - anonSequence = anonSequenceType; + anonSequence = anonSequenceType; } - + public SequenceDeferredAction(Sequence sequenceType) { - sequence = sequenceType; + sequence = sequenceType; } - + public SequenceDeferredAction(XmlSchemaElement elem) { - element = elem; + element = elem; } - + public SequenceDeferredAction(XmlSchemaCollection xmlSchemas, XmlSchema xmlSchema) { schemas = xmlSchemas; - schema = xmlSchema; + schema = xmlSchema; } - + public void execute(XmlSchemaType stype, CorbaTypeImpl ctype) { if (anonSequence != null) { anonSequence.setElemtype(ctype.getQName()); @@ -78,14 +78,9 @@ public class SequenceDeferredAction impl if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) { element.setNillable(true); } - } - if (schemas != null - && schemas.getTypeByQName(stype.getQName()) == null) { - schema.getItems().add(stype); - schema.addType(stype); } } - + } Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java Sun Oct 17 02:30:38 2010 @@ -154,7 +154,7 @@ public class StringVisitor extends Visit private void visitBoundedString() { // xmlschema:bounded string - XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false); + XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, true); simpleType.setName(stringScopedName.toString()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java?rev=1023416&r1=1023415&r2=1023416&view=diff ============================================================================== --- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java (original) +++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java Sun Oct 17 02:30:38 2010 @@ -95,8 +95,6 @@ public final class WSDLASTVisitor implem schema = manager.createXmlSchemaForDefinition(definition, schemans, schemas); declaredWSAImport = false; - addAnyType(); - typeMap = manager.createCorbaTypeMap(definition, corbatypemaptns); // idl:sequence<octet> maps to xsd:base64Binary by default @@ -436,27 +434,6 @@ public final class WSDLASTVisitor implem return def; } - /** - * Older versions of XmlSchema forgot to include anyType in the schema. - */ - private void addAnyType() { - if (schemas.getTypeByQName(Constants.XSD_ANYTYPE) != null) { - return; - } - - XmlSchema[] schemaList = schemas.getXmlSchemas(); - if (schemaList != null) { - for (int i = 0; i < schemaList.length; i++) { - if (schemaList[i].getTargetNamespace().equals(Constants.URI_2001_SCHEMA_XSD)) { - XmlSchemaType anyType = new XmlSchemaType(schemaList[i], false) { }; - anyType.setName(Constants.XSD_ANYTYPE.getLocalPart()); - schemaList[i].addType(anyType); - break; - } - } - } - } - public boolean getDeclaredWSAImport() { return declaredWSAImport; }