Search in sources :

Example 1 with Anonwstring

use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.

the class StringVisitor method visitAnonBoundedString.

private void visitAnonBoundedString() {
    // xmlschema:bounded anon string
    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, true);
    simpleType.setName(stringScopedName.toString());
    XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
    restriction.setBaseTypeName(Constants.XSD_STRING);
    XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
    maxLengthFacet.setValue(boundNode.toString());
    restriction.getFacets().add(maxLengthFacet);
    simpleType.setContent(restriction);
    setSchemaType(simpleType);
    CorbaType anon = null;
    if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
        // corba:anonstring
        Anonstring anonstring = new Anonstring();
        anonstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
        anonstring.setBound(Long.parseLong(boundNode.toString()));
        anonstring.setType(simpleType.getQName());
        anon = anonstring;
    } else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
        // corba:anonwstring
        Anonwstring anonwstring = new Anonwstring();
        anonwstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
        anonwstring.setBound(Long.parseLong(boundNode.toString()));
        anonwstring.setType(simpleType.getQName());
        anon = anonwstring;
    } else {
        // should never get here
        throw new RuntimeException("StringVisitor attempted to visit an invalid node");
    }
    // add corba:anonstring
    typeMap.getStructOrExceptionOrUnion().add(anon);
    setCorbaType(anon);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Anonwstring(org.apache.cxf.binding.corba.wsdl.Anonwstring) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) XmlSchemaSimpleTypeRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction) XmlSchemaMaxLengthFacet(org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet) Anonstring(org.apache.cxf.binding.corba.wsdl.Anonstring)

Example 2 with Anonwstring

use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.

the class StringVisitor method visitBoundedString.

private void visitBoundedString() {
    // xmlschema:bounded string
    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, true);
    simpleType.setName(stringScopedName.toString());
    XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
    restriction.setBaseTypeName(Constants.XSD_STRING);
    XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
    maxLengthFacet.setValue(boundNode.toString());
    restriction.getFacets().add(maxLengthFacet);
    simpleType.setContent(restriction);
    setSchemaType(simpleType);
    Scope anonstringScopedName = new Scope(getScope(), "_Anon1_" + stringScopedName.tail());
    String anonstringName = anonstringScopedName.toString();
    CorbaType anon = null;
    if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
        // corba:anonstring
        Anonstring anonstring = new Anonstring();
        anonstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
        anonstring.setBound(Long.parseLong(boundNode.toString()));
        anonstring.setType(simpleType.getQName());
        anon = anonstring;
    } else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
        // corba:anonwstring
        Anonwstring anonwstring = new Anonwstring();
        anonwstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
        anonwstring.setBound(Long.valueOf(boundNode.toString()));
        anonwstring.setType(simpleType.getQName());
        anon = anonwstring;
    } else {
        // should never get here
        throw new RuntimeException("StringVisitor attempted to visit an invalid node");
    }
    // add corba:anonstring
    typeMap.getStructOrExceptionOrUnion().add(anon);
    // corba:alias
    Alias alias = new Alias();
    alias.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
    alias.setBasetype(anon.getQName());
    alias.setType(simpleType.getQName());
    alias.setRepositoryID(stringScopedName.toIDLRepositoryID());
    // add corba:alias
    setCorbaType(alias);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Anonwstring(org.apache.cxf.binding.corba.wsdl.Anonwstring) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) Alias(org.apache.cxf.binding.corba.wsdl.Alias) XmlSchemaSimpleTypeRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction) XmlSchemaMaxLengthFacet(org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet) Anonstring(org.apache.cxf.binding.corba.wsdl.Anonstring)

Example 3 with Anonwstring

use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.

the class CorbaUtils method getAnonTypeCode.

private static TypeCode getAnonTypeCode(ORB orb, QName type, Object obj, CorbaTypeMap typeMap, Stack<QName> seenTypes) {
    TypeCode tc = null;
    if (obj instanceof Anonarray) {
        Anonarray anonArrayType = (Anonarray) obj;
        tc = orb.create_array_tc((int) anonArrayType.getBound(), getTypeCode(orb, anonArrayType.getElemtype(), typeMap, seenTypes));
    } else if (obj instanceof Anonfixed) {
        Anonfixed anonFixedType = (Anonfixed) obj;
        tc = orb.create_fixed_tc((short) anonFixedType.getDigits(), (short) anonFixedType.getScale());
    } else if (obj instanceof Anonsequence) {
        Anonsequence anonSeqType = (Anonsequence) obj;
        tc = orb.create_sequence_tc((int) anonSeqType.getBound(), getTypeCode(orb, anonSeqType.getElemtype(), typeMap, seenTypes));
    } else if (obj instanceof Anonstring) {
        Anonstring anonStringType = (Anonstring) obj;
        tc = orb.create_string_tc((int) anonStringType.getBound());
    } else if (obj instanceof Anonwstring) {
        Anonwstring anonWStringType = (Anonwstring) obj;
        tc = orb.create_wstring_tc((int) anonWStringType.getBound());
    }
    return tc;
}
Also used : Anonfixed(org.apache.cxf.binding.corba.wsdl.Anonfixed) Anonwstring(org.apache.cxf.binding.corba.wsdl.Anonwstring) TypeCode(org.omg.CORBA.TypeCode) Anonarray(org.apache.cxf.binding.corba.wsdl.Anonarray) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence) Anonstring(org.apache.cxf.binding.corba.wsdl.Anonstring)

Aggregations

Anonstring (org.apache.cxf.binding.corba.wsdl.Anonstring)3 Anonwstring (org.apache.cxf.binding.corba.wsdl.Anonwstring)3 QName (javax.xml.namespace.QName)2 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)2 XmlSchemaMaxLengthFacet (org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet)2 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)2 XmlSchemaSimpleTypeRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction)2 Alias (org.apache.cxf.binding.corba.wsdl.Alias)1 Anonarray (org.apache.cxf.binding.corba.wsdl.Anonarray)1 Anonfixed (org.apache.cxf.binding.corba.wsdl.Anonfixed)1 Anonsequence (org.apache.cxf.binding.corba.wsdl.Anonsequence)1 TypeCode (org.omg.CORBA.TypeCode)1