use of org.apache.cxf.binding.corba.wsdl.Anonstring in project cxf by apache.
the class WSDLTypes method processStringType.
public static CorbaType processStringType(CorbaType corbaTypeImpl, QName name, String maxLength, String length) throws Exception {
boolean boundedString = true;
int bound = 0;
try {
if (maxLength != null) {
bound = Integer.parseInt(maxLength);
} else if (length != null) {
bound = Integer.parseInt(length);
} else {
boundedString = false;
}
} catch (NumberFormatException ex) {
throw new Exception("illegal number", ex);
} catch (Exception e) {
throw new Exception("illegal number", e);
}
if (boundedString) {
// bounded string
Anonstring anonString = new Anonstring();
anonString.setBound(bound);
anonString.setName(name.getLocalPart());
anonString.setQName(name);
anonString.setType(corbaTypeImpl.getQName());
corbaTypeImpl = anonString;
}
return corbaTypeImpl;
}
use of org.apache.cxf.binding.corba.wsdl.Anonstring in project cxf by apache.
the class WSDLToIDLAction method checkAnon.
private IdlType checkAnon(CorbaType corbaTypeImpl, IdlScopeBase scope, String local) throws Exception {
IdlType result = null;
if (corbaTypeImpl instanceof Anonstring) {
Anonstring as = (Anonstring) corbaTypeImpl;
long lbound = as.getBound();
result = IdlString.create((int) lbound);
}
return result;
}
use of org.apache.cxf.binding.corba.wsdl.Anonstring 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();
final CorbaType anon;
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);
}
use of org.apache.cxf.binding.corba.wsdl.Anonstring 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);
final CorbaType anon;
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);
}
use of org.apache.cxf.binding.corba.wsdl.Anonstring 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;
}
Aggregations