use of org.apache.ws.commons.schema.XmlSchemaType in project cxf by apache.
the class TypedefVisitor method visit.
public void visit(AST typedefNode) {
// "typedef" <type_declarator>
// <type_declarator> ::= <type_spec> <declarators>
AST typeDeclaratorNode = typedefNode.getFirstChild();
AST identifierNode = TypesUtils.getCorbaTypeNameNode(typeDeclaratorNode);
TypesVisitor typesVisitor = new TypesVisitor(getScope(), definition, schema, wsdlVisitor, identifierNode);
typesVisitor.visit(typeDeclaratorNode);
XmlSchemaType schemaType = typesVisitor.getSchemaType();
CorbaType corbaType = typesVisitor.getCorbaType();
Scope fullyQualifiedName = typesVisitor.getFullyQualifiedName();
Scope typedefScope = new Scope(getScope(), identifierNode);
if (SequenceVisitor.accept(typeDeclaratorNode) || FixedVisitor.accept(typeDeclaratorNode)) {
// Handle cases "typedef sequence"
// "typedef fixed"
DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope, definition, schema, wsdlVisitor, schemaType, corbaType, fullyQualifiedName);
declaratorVisitor.visit(identifierNode);
} else if (StringVisitor.accept(typeDeclaratorNode)) {
if (StringVisitor.isBounded(typeDeclaratorNode) && !wsdlVisitor.getBoundedStringOverride()) {
DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope, definition, schema, wsdlVisitor, schemaType, corbaType, fullyQualifiedName);
declaratorVisitor.visit(identifierNode);
} else {
while (identifierNode != null) {
if (ArrayVisitor.accept(identifierNode)) {
ArrayVisitor arrayVisitor = new ArrayVisitor(new Scope(getScope(), identifierNode.getText()), definition, schema, wsdlVisitor, identifierNode, fullyQualifiedName);
arrayVisitor.setSchemaType(schemaType);
arrayVisitor.setCorbaType(corbaType);
arrayVisitor.visit(identifierNode);
} else {
generateStringAlias(typeDeclaratorNode, identifierNode, schemaType, corbaType, fullyQualifiedName);
}
identifierNode = identifierNode.getNextSibling();
}
}
} else {
// if declaring an array, do not generate aliases
if (!ArrayVisitor.accept(identifierNode)) {
generateAlias(identifierNode, schemaType, corbaType, fullyQualifiedName);
corbaType = getCorbaType();
}
DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope, definition, schema, wsdlVisitor, schemaType, corbaType, fullyQualifiedName);
declaratorVisitor.visit(identifierNode);
}
setSchemaType(schemaType);
setCorbaType(corbaType);
setFullyQualifiedName(fullyQualifiedName);
}
use of org.apache.ws.commons.schema.XmlSchemaType in project cxf by apache.
the class UnionVisitor method processForwardUnionActions.
// Process any actions that were defered for a forward declared union
private void processForwardUnionActions(Scope unionScope) {
if (wsdlVisitor.getDeferredActions() != null) {
DeferredActionCollection deferredActions = wsdlVisitor.getDeferredActions();
List<DeferredAction> list = deferredActions.getActions(unionScope);
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.ws.commons.schema.XmlSchemaType in project cxf by apache.
the class PortTypeVisitor method handleDeferredActions.
private void handleDeferredActions(DeferredActionCollection deferredActions, Scope scopedName, AST identifierNode) {
List<DeferredAction> list = deferredActions.getActions(scopedName);
if ((list != null) && !list.isEmpty()) {
XmlSchemaType stype = null;
CorbaTypeImpl ctype = null;
if (ObjectReferenceVisitor.accept(getScope(), schema, definition, identifierNode, wsdlVisitor)) {
ObjectReferenceVisitor visitor = new ObjectReferenceVisitor(getScope(), definition, schema, wsdlVisitor);
visitor.visit(identifierNode);
stype = visitor.getSchemaType();
ctype = visitor.getCorbaType();
}
for (DeferredAction action : list) {
if (action instanceof SchemaDeferredAction && (stype != null) && (ctype != null)) {
SchemaDeferredAction schemaAction = (SchemaDeferredAction) action;
schemaAction.execute(stype, ctype);
}
}
deferredActions.removeScope(scopedName);
}
}
use of org.apache.ws.commons.schema.XmlSchemaType 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.ws.commons.schema.XmlSchemaType in project cxf by apache.
the class ServiceJavascriptBuilder method getElementType.
/**
* Follow a chain of references from element to element until we can obtain
* a type.
*
* @param element
*/
public static XmlSchemaType getElementType(SchemaCollection xmlSchemaCollection, String referencingURI, XmlSchemaElement element, XmlSchemaType containingType) {
assert element != null;
if (element.getSchemaTypeName() != null) {
XmlSchemaType type = xmlSchemaCollection.getTypeByQName(element.getSchemaTypeName());
if (type == null) {
Message message = new Message("ELEMENT_TYPE_MISSING", LOG, element.getQName(), element.getSchemaTypeName().toString());
throw new UnsupportedConstruct(message);
}
return type;
}
// The referencing URI only helps if there is a schema that points to
// it.
// It might be the URI for the wsdl TNS, which might have no schema.
// if (xmlSchemaCollection.getSchemaByTargetNamespace(referencingURI) == null) {
// referencingURI = null;
// }
//
// if (referencingURI == null && containingType != null) {
// referencingURI = containingType.getQName().getNamespaceURI();
// }
XmlSchemaElement originalElement = element;
while (element.getSchemaType() == null && element.isRef()) {
/*
* This code assumes that all schemas are in the collection.
*/
XmlSchemaElement nextElement = element.getRef().getTarget();
assert nextElement != null;
element = nextElement;
}
if (element.getSchemaType() == null) {
unsupportedConstruct("ELEMENT_HAS_NO_TYPE", originalElement.getName(), containingType.getQName(), containingType);
}
return element.getSchemaType();
}
Aggregations