Package org.apache.airavata.xbaya.component

Examples of org.apache.airavata.xbaya.component.ComponentException


            WsdlPortType portType = this.wsdl.getPortType(portTypeQName.getLocalPart());
            XmlElement templateIDElement = portType.xml().element(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG);
            String templateIDString = templateIDElement.requiredText();
            this.templateID = new URI(templateIDString);
        } catch (URISyntaxException e) {
            throw new ComponentException(e);
        }
    }
View Full Code Here


                String templateIDString = templateIDElement.requiredText();
                URI templateID = new URI(templateIDString);
                return templateID;
            }
        } catch (URISyntaxException e) {
            throw new ComponentException(e);
        } catch (UtilsException e) {
            throw new ComponentException(e);
        }
    }
View Full Code Here

     */
    public static List<WSComponent> createComponents(String wsdlString) throws ComponentException {
        try {
            return createComponents(XMLUtil.stringToXmlElement(wsdlString));
        } catch (RuntimeException e) {
            throw new ComponentException(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
        }

    }
View Full Code Here

    public static List<WSComponent> createComponents(XmlElement componentElement) throws ComponentException {
        try {
            WsdlDefinitions definitions = new WsdlDefinitions(componentElement);
            return createComponents(definitions);
        } catch (RuntimeException e) {
            throw new ComponentException(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
        }
    }
View Full Code Here

                String operationName = operation.getOperationName();
                WSComponent component = createComponent(wsdl, portTypeQName, operationName);
                components.add(component);
            }
        } catch (Exception e) {
            throw new ComponentException(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
        }
        return components;
    }
View Full Code Here

            } else {
                component = new WorkflowComponent(wsdl, portTypeQName, operationName);
            }
            return component;
        } catch (RuntimeException e) {
            throw new ComponentException(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
        } catch (UtilsException e) {
            throw new ComponentException(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
        }
    }
View Full Code Here

            if (prefix == null) {
                if ("string".equals(typeName) || "int".equals(typeName)) {
                    namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
                    prefix = "xsd";
                } else {
                    throw new ComponentException("Namespace prefix, " + prefix + ", is not defined");
                }
            } else {
                namespace = element.lookupNamespaceByPrefix(prefix);
            }
            this.type = new QName(namespace.getName(), typeName, prefix);
View Full Code Here

            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.xbaya.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.