Search in sources :

Example 31 with Message

use of org.apache.cxf.common.i18n.Message 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();
}
Also used : Message(org.apache.cxf.common.i18n.Message) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) UnsupportedConstruct(org.apache.cxf.javascript.UnsupportedConstruct) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 32 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class ServiceJavascriptBuilder method unsupportedConstruct.

public static void unsupportedConstruct(String messageKey, String what, QName subjectName, XmlSchemaObject subject) {
    Message message = new Message(messageKey, LOG, what, subjectName == null ? "anonymous" : subjectName, cleanedUpSchemaSource(subject));
    LOG.severe(message.toString());
    throw new UnsupportedConstruct(message);
}
Also used : Message(org.apache.cxf.common.i18n.Message) UnsupportedConstruct(org.apache.cxf.javascript.UnsupportedConstruct)

Example 33 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class ServiceJavascriptBuilder method unsupportedConstruct.

public static void unsupportedConstruct(String messageKey, XmlSchemaType subject) {
    Message message = new Message(messageKey, LOG, subject.getQName(), cleanedUpSchemaSource(subject));
    LOG.severe(message.toString());
    throw new UnsupportedConstruct(message);
}
Also used : Message(org.apache.cxf.common.i18n.Message) UnsupportedConstruct(org.apache.cxf.javascript.UnsupportedConstruct)

Example 34 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class AssertionBuilderRegistryImpl method handleNoRegisteredBuilder.

protected AssertionBuilder<?> handleNoRegisteredBuilder(QName qname) {
    if (ignoreUnknownAssertions) {
        boolean alreadyWarned = ignored.contains(qname);
        if (!alreadyWarned) {
            ignored.add(qname);
            Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
            LOG.warning(m.toString());
        }
        return new XMLPrimitiveAssertionBuilder();
    }
    Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
    throw new PolicyException(m);
}
Also used : Message(org.apache.cxf.common.i18n.Message) XMLPrimitiveAssertionBuilder(org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder)

Example 35 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class BaseGreeterImpl method pingMe.

public void pingMe(String faultType) throws PingMeFault {
    if ("USER".equals(faultType)) {
        FaultDetail detail = new FaultDetail();
        detail.setMajor((short) 1);
        detail.setMinor((short) 2);
        throw new PingMeFault("USER FAULT TEST", detail);
    } else if ("SYSTEM".equals(faultType)) {
        throw new Fault(new Message(EX_STRING, (ResourceBundle) null, new Object[] { "FAULT TEST" }));
    } else {
        throw new IllegalArgumentException(EX_STRING);
    }
}
Also used : PingMeFault(org.apache.cxf.hello_world_corba.PingMeFault) Message(org.apache.cxf.common.i18n.Message) FaultDetail(org.apache.cxf.hello_world_corba.types.FaultDetail) PingMeFault(org.apache.cxf.hello_world_corba.PingMeFault) Fault(org.apache.cxf.interceptor.Fault)

Aggregations

Message (org.apache.cxf.common.i18n.Message)201 ToolException (org.apache.cxf.tools.common.ToolException)69 IOException (java.io.IOException)45 QName (javax.xml.namespace.QName)42 Fault (org.apache.cxf.interceptor.Fault)34 XMLStreamException (javax.xml.stream.XMLStreamException)27 JAXBException (javax.xml.bind.JAXBException)23 ArrayList (java.util.ArrayList)19 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)17 Element (org.w3c.dom.Element)17 File (java.io.File)16 WSDLException (javax.wsdl.WSDLException)15 Method (java.lang.reflect.Method)14 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)13 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)12 InputStream (java.io.InputStream)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Map (java.util.Map)11 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)11