protected RelayResult deliver() {
try {
String receiverDomain = receiver.getDomain();
if (receiverDomain != null && !EntityUtils.isAddressingServer(receiver, serverEntity)) {
if (serverRuntimeContext == null) {
return new RelayResult(new ServiceNotAvailableException(
"cannot retrieve component from server context"));
}
if (!EntityUtils.isAddressingServerComponent(receiver, serverEntity)) {
return new RelayResult(new ServiceNotAvailableException("unsupported domain " + receiverDomain));
}
StanzaProcessor processor = serverRuntimeContext.getComponentStanzaProcessor(receiver);
if (processor == null) {
return new RelayResult(new ServiceNotAvailableException(
"cannot retrieve component stanza processor for" + receiverDomain));
}
processor.processStanza(serverRuntimeContext, null, stanza, null);
return new RelayResult();