use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class ParamDclVisitor method visit.
public void visit(AST node) {
// <param_dcl> ::= <param_attribute> <param_type_spec> <simple_declarator>
// <param_attribute> ::= "in"
// | "out"
// | "inout"
AST typeNode = node.getFirstChild();
AST nameNode = TypesUtils.getCorbaTypeNameNode(typeNode);
ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(), definition, schema, wsdlVisitor);
visitor.visit(typeNode);
XmlSchemaType schemaType = visitor.getSchemaType();
CorbaType corbaType = visitor.getCorbaType();
Scope fullyQualifiedName = visitor.getFullyQualifiedName();
switch(node.getType()) {
case IDLTokenTypes.LITERAL_in:
addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
addCorbaParam(corbaType, ModeType.IN, nameNode.toString(), fullyQualifiedName);
break;
case IDLTokenTypes.LITERAL_out:
addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
addCorbaParam(corbaType, ModeType.OUT, nameNode.toString(), fullyQualifiedName);
break;
case IDLTokenTypes.LITERAL_inout:
addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString(), fullyQualifiedName);
break;
default:
throw new RuntimeException("[ParamDclVisitor: illegal IDL!]");
}
setSchemaType(schemaType);
setCorbaType(corbaType);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class PrimitiveTypesVisitor method visit.
public void visit(AST node) {
// <base_type_spec> ::= <floating_pt_type>
// | <integer_type>
// | <char_type>
// | <wide_char_type>
// | <boolean_type>
// | <octet_type>
// | <any_type>
// | <object_type> <= NOT SUPPORTED
// | <value_base_type> <= NOT SUPPORTED
// <floating_pt_type> ::= "float"
// | "double"
// | "long" double"
// <integer_type> ::= <signed_int>
// | <unsigned_int>
// <signed_int> ::= <signed_short_int>
// | <signed_long_int>
// | <signed_longlong_int>
// <signed_short_int> ::= "short"
// <signed_long_int> ::= "long"
// <signed_longlong_int> ::= "long" "long"
// <unsigned_int> ::= <unsigned_short_int>
// | <unsigned_long_int>
// | <unsigned_longlong_int>
// <unsigned_short_int> ::= "unsigned" "short"
// <unsigned_long_int> ::= "unsigned" "long"
// <unsigned_longlong_int> ::= "unsigned" "long" "long"
// <char_type> ::= "char"
// <wide_char_type> ::= "wchar"
// <boolean_type> ::= "boolean"
// <octet_type> ::= "octet"
// <any_type> ::= "any"
XmlSchemaType stype = null;
CorbaType ctype = null;
QName corbaTypeQName = PrimitiveTypesVisitor.getPrimitiveType(node);
if (corbaTypeQName != null) {
QName schemaTypeQName = xmlSchemaPrimitiveMap.get(corbaTypeQName);
if (schemaTypeQName != null) {
// XmlSchemaCollection schemas = new XmlSchemaCollection();
stype = schemas.getTypeByQName(schemaTypeQName);
if (stype != null) {
ctype = new CorbaType();
ctype.setQName(corbaTypeQName);
ctype.setType(stype.getQName());
ctype.setName(stype.getQName().getLocalPart());
}
}
}
schemaType = stype;
corbaType = ctype;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class ScopedNameVisitor method visit.
public void visit(AST node) {
// <scoped_name> ::= <identifier>
// | :: <identifier>
// | <scoped_name> "::" <identifier>
XmlSchemaType stype = null;
CorbaType ctype = null;
if (PrimitiveTypesVisitor.accept(node)) {
// primitive type
PrimitiveTypesVisitor primitiveVisitor = new PrimitiveTypesVisitor(null, definition, schema, schemas);
primitiveVisitor.visit(node);
stype = primitiveVisitor.getSchemaType();
ctype = primitiveVisitor.getCorbaType();
} else if (isforwardDeclared(getScope(), node, wsdlVisitor)) {
// forward declaration
Scope scope = forwardDeclared(getScope(), definition, schema, node, wsdlVisitor);
setFullyQualifiedName(scope);
// how will we create the corbatype ????
} else if (ObjectReferenceVisitor.accept(getScope(), schema, definition, node, wsdlVisitor)) {
ObjectReferenceVisitor objRefVisitor = new ObjectReferenceVisitor(getScope(), definition, schema, wsdlVisitor);
objRefVisitor.visit(node);
stype = objRefVisitor.getSchemaType();
ctype = objRefVisitor.getCorbaType();
} else {
VisitorTypeHolder holder = new VisitorTypeHolder();
boolean found = findSchemaType(getScope(), definition, schema, node, wsdlVisitor, holder);
if (found) {
ctype = holder.getCorbaType();
stype = holder.getSchemaType();
} else {
Scope scopedName = new Scope(getScope(), node);
QName qname = new QName(schema.getTargetNamespace(), scopedName.toString());
throw new RuntimeException("[ScopedNameVisitor: Corba type " + qname + " not found in typeMap]");
}
}
setSchemaType(stype);
setCorbaType(ctype);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class ScopedNameVisitor method populateAliasSchemaType.
protected static void populateAliasSchemaType(CorbaType corbaType, WSDLASTVisitor wsdlVisitor, VisitorTypeHolder holder) {
XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
TypeMappingType typeMap = wsdlVisitor.getTypeMap();
holder.setCorbaType(corbaType);
Alias alias = (Alias) corbaType;
// loop through alias base types, till you get a non-alias corba type
CorbaType type = findCorbaType(typeMap, alias.getBasetype());
while ((type != null) && (type instanceof Alias)) {
alias = (Alias) type;
type = findCorbaType(typeMap, alias.getBasetype());
}
QName tname;
if (type == null) {
// it must be a primitive type
tname = xmlSchemaPrimitiveMap.get(alias.getBasetype());
} else {
tname = type.getType();
}
XmlSchemaType stype = schemas.getTypeByQName(tname);
if (stype == null) {
XmlSchema xmlSchema = wsdlVisitor.getManager().getXmlSchema(tname.getNamespaceURI());
if (xmlSchema != null) {
stype = xmlSchema.getTypeByName(tname);
} else {
stype = wsdlVisitor.getSchema().getTypeByName(tname);
}
}
holder.setSchemaType(stype);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class ScopedNameVisitor method findNonSchemaType.
protected static boolean findNonSchemaType(String name, WSDLASTVisitor wsdlVisitor, VisitorTypeHolder holder) {
boolean result = false;
TypeMappingType typeMap = wsdlVisitor.getTypeMap();
XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
QName qname = new QName(typeMap.getTargetNamespace(), name);
CorbaType corbaType = findCorbaType(typeMap, qname);
if (corbaType != null) {
if (corbaType instanceof Alias) {
result = true;
if (holder != null) {
populateAliasSchemaType(corbaType, wsdlVisitor, holder);
}
} else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence)) && ((corbaType.getType().equals(Constants.XSD_BASE64)))) {
// special case of sequence of octets
result = true;
if (holder != null) {
holder.setCorbaType(corbaType);
holder.setSchemaType(schemas.getTypeByQName(corbaType.getType()));
}
}
}
return result;
}
Aggregations