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();
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations