use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class SequenceVisitor method visit.
public void visit(AST seq) {
// <sequence_type> ::= "sequence" "<" <simple_type_spec> "," <positive_int_const> ">"
// | "sequence" "<" <simple_type_spec> ">"
AST simpleTypeSpecNode = seq.getFirstChild();
// REVISIT: TypesUtils.getPrimitiveCorbaTypeNameNode should be renamed
// to something more suitable and should be made more general.
AST boundNode = TypesUtils.getCorbaTypeNameNode(simpleTypeSpecNode);
// if so, replace the symbol name with defined const
if (boundNode != null) {
String constValue = TypesUtils.getConstValueByName(boundNode, typeMap);
if (constValue != null) {
boundNode.setText(constValue);
}
}
SimpleTypeSpecVisitor visitor = new SimpleTypeSpecVisitor(new Scope(getScope(), identifierNode), definition, schema, wsdlVisitor, null);
visitor.visit(simpleTypeSpecNode);
XmlSchemaType stype = visitor.getSchemaType();
CorbaType ctype = visitor.getCorbaType();
Scope fullyQualifiedName = visitor.getFullyQualifiedName();
long bound = -1;
if (boundNode != null) {
bound = Long.parseLong(boundNode.toString());
}
final Scope scopedName;
if (identifierNode == null) {
// anonymous type
scopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema);
} else {
scopedName = new Scope(getScope(), identifierNode);
}
final XmlSchemaType schemaType;
//
if (stype != null) {
if (!stype.getQName().equals(Constants.XSD_UNSIGNEDBYTE)) {
schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
} else {
schemaType = wsdlVisitor.getSequenceOctetType();
}
} else {
schemaType = generateSchemaType(null, scopedName, bound, fullyQualifiedName);
}
final CorbaType corbaType;
if (identifierNode == null) {
corbaType = generateCorbaAnonsequence(ctype, schemaType, scopedName, bound, fullyQualifiedName);
} else {
corbaType = generateCorbaSequence(ctype, schemaType, scopedName, bound, fullyQualifiedName);
}
setSchemaType(schemaType);
setCorbaType(corbaType);
setFullyQualifiedName(fullyQualifiedName);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class StringVisitor method visitUnboundedString.
private void visitUnboundedString() {
// schema type
setSchemaType(schemas.getTypeByQName(Constants.XSD_STRING));
// corba type
CorbaType corbaString = new CorbaType();
if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
corbaString.setQName(CorbaConstants.NT_CORBA_STRING);
corbaString.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
} else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
corbaString.setQName(CorbaConstants.NT_CORBA_WSTRING);
corbaString.setName(CorbaConstants.NT_CORBA_WSTRING.getLocalPart());
} else {
// should never get here
throw new RuntimeException("StringVisitor attempted to visit an invalid node");
}
corbaString.setType(Constants.XSD_STRING);
setCorbaType(corbaString);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class StructVisitor method processForwardStructActions.
// Process any actions that were defered for a forward declared struct
private void processForwardStructActions(Scope structScope) {
if (wsdlVisitor.getDeferredActions() != null) {
DeferredActionCollection deferredActions = wsdlVisitor.getDeferredActions();
List<DeferredAction> list = deferredActions.getActions(structScope);
if ((list != null) && !list.isEmpty()) {
XmlSchemaType stype = getSchemaType();
CorbaType ctype = getCorbaType();
Iterator<DeferredAction> iterator = list.iterator();
while (iterator.hasNext()) {
SchemaDeferredAction action = (SchemaDeferredAction) iterator.next();
action.execute(stype, ctype);
}
iterator = list.iterator();
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
}
}
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class CorbaPrimitiveMapTest method testMap.
@Test
public void testMap() {
Map<QName, CorbaType> map = new HashMap<>();
QName corbaName = new QName("http://cxf.apache.org/bindings/corba", "string", "corba");
QName typeName = new QName("http://www.w3.org/2001/XMLSchema", "string");
CorbaType corbaTypeImpl = new CorbaType();
corbaTypeImpl.setQName(corbaName);
corbaTypeImpl.setType(typeName);
corbaTypeImpl.setName(corbaName.getLocalPart());
map.put(typeName, corbaTypeImpl);
Object value = map.get(typeName);
Assert.assertEquals(corbaTypeImpl.getName(), corbaName.getLocalPart());
Assert.assertEquals(corbaTypeImpl.getQName(), corbaName);
Assert.assertEquals(corbaTypeImpl.getType(), typeName);
Assert.assertEquals(corbaTypeImpl, value);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class ScopedNameVisitor method getCorbaSchemaType.
private static CorbaType getCorbaSchemaType(XmlSchema xmlSchema, TypeMappingType typeMap, XmlSchemaType stype, Scope scopedName) {
final CorbaType ctype;
if (stype.getQName().equals(Constants.XSD_STRING)) {
ctype = new CorbaType();
ctype.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
ctype.setQName(CorbaConstants.NT_CORBA_STRING);
ctype.setType(Constants.XSD_STRING);
} else {
QName qname = stype.getQName();
ctype = findCorbaTypeForSchemaType(typeMap, qname, scopedName);
}
return ctype;
}
Aggregations