Package org.apache.airavata.workflow.model.component

Examples of org.apache.airavata.workflow.model.component.ComponentException


            this.description = buf.toString();
        }

        WsdlPortType portType = this.wsdl.getPortType(this.portTypeQName.getLocalPart());
        if (portType == null) {
            throw new ComponentException("portType, " + this.portTypeQName + " is not defined.");
        }
        parsePortType(portType);
    }
View Full Code Here


    }

    private void parsePortType(WsdlPortType portType) throws ComponentException {
        WsdlPortTypeOperation operation = portType.getOperation(this.operationName);
        if (operation == null) {
            throw new ComponentException("Operation, " + this.operationName + " is not defined.");
        }
        parseOperation(operation);
    }
View Full Code Here

    private void parseType(String typeName, List<WSComponentPort> parts) throws ComponentException {

        XmlElement typesElement = this.wsdl.getTypes();
        if (typesElement == null) {
            throw new ComponentException("No types is defined.");
        }

        if (typesElement.element(null, WSConstants.SCHEMA_TAG) == null) {
            throw new ComponentException("No schema is defined.");
        }

        XmlElement elementElement = null;
        XmlElement schemaElement = null;

        Iterable<XmlElement> schemaElements = typesElement.elements(null, WSConstants.SCHEMA_TAG);
        for (XmlElement elemt : schemaElements) {
            schemaElement = elemt;
            elementElement = findElementElement(typeName, elemt);
            if (null != elementElement) {
                break;
            }
        }

        if (elementElement == null) {
            throw new ComponentException("No element is defined for " + typeName);
        }
        String typesTargetNamespace = schemaElement.attributeValue(WSConstants.TARGET_NAMESPACE_ATTRIBUTE);
        String elementType = elementElement.attributeValue(WSConstants.TYPE_ATTRIBUTE);

        XmlElement sequenceElement;
        if (elementType == null) {
            // anonymous type
            XmlElement complexElement = elementElement.element(null, WSConstants.COMPLEX_TYPE_TAG);
            if (complexElement == null) {
                throw new ComponentException("We only support complexType as annonymous type: "
                        + XMLUtil.xmlElementToString(elementElement));
            }
            sequenceElement = complexElement.element(null, WSConstants.SEQUENCE_TAG);
            // TODO Check if there is any other defined.
        } else {
            // named complexType
            String elementTypeName = XMLUtil.getLocalPartOfQName(elementType);
            XmlElement typeElement = findTypeElement(elementTypeName, schemaElement);
            sequenceElement = typeElement.element(null, WSConstants.SEQUENCE_TAG);
            // TODO Check if there is any other defined.
        }

        if (sequenceElement == null) {
            // Assume that there is no input/output.
            logger.info("There is no sequence defined.");
        } else {
            // Only supports elements in the sequence now.
            for (XmlElement element : sequenceElement.elements(null, WSConstants.ELEMENT_TAG)) {
                WSComponentPort componentPort = new WSComponentPort(element, typesTargetNamespace, this);
                // Check if the type is defined in types
                QName paramType = componentPort.getType();
                if (!(WSConstants.XSD_NS_URI.equalsIgnoreCase(paramType.getNamespaceURI()))) {
                    XmlElement typeDefinition = null;
                    try {
                        typeDefinition = WSDLUtil.getTypeDefinition(this.wsdl, paramType);
                    } catch (UtilsException e) {
                        e.printStackTrace();
                    }
                    if (typeDefinition == null) {
                        throw new ComponentException("could not find definition for type " + paramType + " in "
                                + this.wsdlQName);
                    }
                }
                parts.add(componentPort);
            }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.component.ComponentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.