Exemple #1
0
  private void removeRecursiveScopedName(AST identifierNode) {
    String structName = identifierNode.toString();
    Scope structScope = new Scope(getScope(), structName);

    ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames();
    scopedNames.remove(structScope);
  }
Exemple #2
0
  private void visitForwardDeclaredUnion(AST identifierNode) {
    String unionName = identifierNode.toString();
    Scope unionScope = new Scope(getScope(), unionName);

    ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames();
    if (scopedNames.getScope(unionScope) == null) {
      scopedNames.add(unionScope);
    }
  }
Exemple #3
0
  private void visitForwardDeclaredStruct(AST identifierNode) {
    String structName = identifierNode.toString();
    Scope structScope = new Scope(getScope(), structName);

    ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames();
    if (scopedNames.getScope(structScope) == null) {
      scopedNames.add(structScope);
    }
  }
Exemple #4
0
  private boolean addRecursiveScopedName(AST identifierNode) {
    String structName = identifierNode.toString();
    Scope structScope = new Scope(getScope(), structName);

    ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames();
    if (scopedNames.getScope(structScope) == null) {
      scopedNames.add(structScope);
      return true;
    }
    return false;
  }
Exemple #5
0
 private MemberType createMemberType(AST memberNode, CorbaTypeImpl corbaType, Scope fqName) {
   // corba:member
   String memberName = memberNode.toString();
   MemberType memberType = new MemberType();
   memberType.setName(memberName);
   if (corbaType != null) {
     memberType.setIdltype(corbaType.getQName());
   } else {
     wsdlVisitor.getDeferredActions().add(fqName, new StructDeferredAction(memberType));
   }
   return memberType;
 }
Exemple #6
0
 private XmlSchemaElement createXmlSchemaElement(
     AST memberNode, XmlSchemaType schemaType, Scope fqName) {
   // xmlschema:member
   XmlSchemaElement member = new XmlSchemaElement();
   String memberName = memberNode.toString();
   member.setName(memberName);
   member.setSchemaType(schemaType);
   if (schemaType != null) {
     member.setSchemaTypeName(schemaType.getQName());
     if (schemaType.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
       member.setNillable(true);
     }
   } else {
     wsdlVisitor.getDeferredActions().add(fqName, new StructDeferredAction(member));
   }
   return member;
 }
Exemple #7
0
  private void createCase(AST caseNode, Unionbranch unionBranch) {
    AST node = caseNode.getFirstChild();
    if (node != null) {
      if (node.getType() == IDLTokenTypes.LITERAL_case) {
        // corba:case
        CaseType caseType = new CaseType();
        caseType.setLabel(node.getNextSibling().toString());
        unionBranch.getCase().add(caseType);

        // recursive call
        createCase(node, unionBranch);
      } else {
        // corba:case
        CaseType caseType = new CaseType();
        caseType.setLabel(node.toString());
        unionBranch.getCase().add(caseType);
      }
    }
  }
Exemple #8
0
  private void processCaseNodes(
      AST caseNode, Scope scope, XmlSchemaChoice choice, Union corbaUnion) {
    while (caseNode != null) {
      AST typeNode = null;
      AST nameNode = null;
      AST labelNode = null;

      // xmlschema:element
      XmlSchemaElement element = new XmlSchemaElement();

      // corba:unionbranch
      Unionbranch unionBranch = new Unionbranch();

      if (caseNode.getType() == IDLTokenTypes.LITERAL_default) {
        // default:
        unionBranch.setDefault(true);

        typeNode = caseNode.getFirstChild();
        nameNode = typeNode.getNextSibling();
      } else {
        // case:
        createCase(caseNode, unionBranch);

        labelNode = caseNode.getFirstChild();
        if (labelNode.getType() == IDLTokenTypes.LITERAL_case) {
          labelNode = labelNode.getNextSibling();
        }

        typeNode = labelNode.getNextSibling();
        nameNode = typeNode.getNextSibling();
      }

      TypesVisitor visitor = new TypesVisitor(scope, definition, schema, wsdlVisitor, null);
      visitor.visit(typeNode);
      XmlSchemaType stype = visitor.getSchemaType();
      CorbaTypeImpl ctype = visitor.getCorbaType();
      Scope fullyQualifiedName = visitor.getFullyQualifiedName();

      // needed for anonymous arrays in unions
      if (ArrayVisitor.accept(nameNode)) {
        Scope anonScope = new Scope(scope, TypesUtils.getCorbaTypeNameNode(nameNode));
        ArrayVisitor arrayVisitor =
            new ArrayVisitor(anonScope, definition, schema, wsdlVisitor, null, fullyQualifiedName);
        arrayVisitor.setSchemaType(stype);
        arrayVisitor.setCorbaType(ctype);
        arrayVisitor.visit(nameNode);
        stype = arrayVisitor.getSchemaType();
        ctype = arrayVisitor.getCorbaType();
        fullyQualifiedName = visitor.getFullyQualifiedName();
      }

      // xmlschema:element
      element.setName(nameNode.toString());
      if (stype != null) {
        element.setSchemaTypeName(stype.getQName());
        if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
          element.setNillable(true);
        }
      } else {
        UnionDeferredAction elementAction = new UnionDeferredAction(element);
        wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
      }
      choice.getItems().add(element);

      // corba:unionbranch
      unionBranch.setName(nameNode.toString());
      if (ctype != null) {
        unionBranch.setIdltype(ctype.getQName());
      } else {
        // its type is forward declared.
        UnionDeferredAction unionBranchAction = new UnionDeferredAction(unionBranch);
        wsdlVisitor.getDeferredActions().add(fullyQualifiedName, unionBranchAction);
      }
      corbaUnion.getUnionbranch().add(unionBranch);

      caseNode = caseNode.getNextSibling();
    }
  }