use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class AbstractToolContainer method getBus.
public Bus getBus() {
Bus bus = BusFactory.getDefaultBus();
OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
String catalogLocation = getCatalogURL();
if (!StringUtils.isEmpty(catalogLocation)) {
try {
catalogManager.loadCatalog(new URI(catalogLocation).toURL());
} catch (Exception e) {
e.printStackTrace(err);
throw new ToolException(new Message("FOUND_NO_FRONTEND", LOG, catalogLocation));
}
}
return bus;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class AbstractToolContainer method init.
public void init() throws ToolException {
// initialize
if (toolspec == null) {
Message message = new Message("TOOLSPEC_NOT_INITIALIZED", LOG);
LOG.log(Level.SEVERE, message.toString());
throw new ToolException(message);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class VelocityGenerator method parseOutputName.
public File parseOutputName(String packageName, String filename, String ext) throws ToolException {
FileUtils.mkDir(new File(this.baseDir));
FileWriterUtil fw = new FileWriterUtil(this.baseDir, null);
try {
return fw.getFileToWrite(packageName, filename + ext);
} catch (IOException ioe) {
Message msg = new Message("FAIL_TO_WRITE_FILE", LOG, packageName + "." + filename + ext);
throw new ToolException(msg, ioe);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLRefValidator method collectValidationPointsForMessages.
private void collectValidationPointsForMessages() {
for (QName msgName : messageRefNames) {
javax.wsdl.Message message = getMessage(msgName);
for (Iterator<?> iter = message.getParts().values().iterator(); iter.hasNext(); ) {
Part part = (Part) iter.next();
QName elementName = part.getElementName();
QName typeName = part.getTypeName();
if (elementName == null && typeName == null) {
vResults.addError(new Message("PART_NO_TYPES", LOG));
continue;
}
if (elementName != null && typeName != null) {
vResults.addError(new Message("PART_NOT_UNIQUE", LOG));
continue;
}
if (elementName != null && typeName == null) {
boolean valid = validatePartType(elementName.getNamespaceURI(), elementName.getLocalPart(), true);
if (!valid) {
vResults.addError(new Message("TYPE_REF_NOT_FOUND", LOG, message.getQName(), part.getName(), elementName));
}
}
if (typeName != null && elementName == null) {
boolean valid = validatePartType(typeName.getNamespaceURI(), typeName.getLocalPart(), false);
if (!valid) {
vResults.addError(new Message("TYPE_REF_NOT_FOUND", LOG, message.getQName(), part.getName(), typeName));
}
}
}
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLRefValidator method collectValidationPointsForPortTypes.
private void collectValidationPointsForPortTypes() {
for (QName ptName : portTypeRefNames) {
PortType portType = getPortType(ptName);
if (portType == null) {
vResults.addError(new Message("NO_PORTTYPE", LOG, ptName));
continue;
}
XNode vPortTypeNode = getXNode(portType);
for (Operation operation : getOperations(portType).values()) {
XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName());
if (operation.getInput() == null) {
vResults.addError(new Message("WRONG_MEP", LOG, operation.getName(), portType.getQName()));
continue;
}
javax.wsdl.Message inMsg = operation.getInput().getMessage();
if (inMsg == null) {
addWarning("Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no input message");
} else {
XNode vInMsgNode = getXNode(inMsg);
vInMsgNode.setFailurePoint(getInputXNode(vOperationNode, operation.getInput().getName()));
vNodes.add(vInMsgNode);
messageRefNames.add(inMsg.getQName());
}
if (operation.getOutput() != null) {
javax.wsdl.Message outMsg = operation.getOutput().getMessage();
if (outMsg == null) {
addWarning("Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no output message");
} else {
XNode vOutMsgNode = getXNode(outMsg);
vOutMsgNode.setFailurePoint(getOutputXNode(vOperationNode, operation.getOutput().getName()));
vNodes.add(vOutMsgNode);
messageRefNames.add(outMsg.getQName());
}
}
for (Iterator<?> iter = operation.getFaults().values().iterator(); iter.hasNext(); ) {
Fault fault = (Fault) iter.next();
javax.wsdl.Message faultMsg = fault.getMessage();
XNode vFaultMsgNode = getXNode(faultMsg);
vFaultMsgNode.setFailurePoint(getFaultXNode(vOperationNode, fault.getName()));
vNodes.add(vFaultMsgNode);
messageRefNames.add(faultMsg.getQName());
}
}
}
}
Aggregations