use of won.protocol.message.processor.exception.UriNodePathException in project webofneeds by researchstudio-sat.
the class UriConsistencyCheckingWonMessageProcessor method checkDirection.
private void checkDirection(final WonMessage message, final URI ownNode) {
WonMessageDirection direction = message.getEnvelopeType();
URI receiverNode = message.getReceiverNodeURI();
URI senderNode = message.getSenderNodeURI();
URI node;
switch(direction) {
case FROM_EXTERNAL:
// my node should be a receiver node
if (!ownNode.equals(receiverNode)) {
throw new UriNodePathException(receiverNode + " is expected to be " + ownNode);
}
break;
case FROM_OWNER:
// my node should be a sender node
if (!ownNode.equals(senderNode)) {
throw new UriNodePathException(senderNode + " is expected to be " + ownNode);
}
break;
case FROM_SYSTEM:
// my node should be a sender node
if (!ownNode.equals(senderNode)) {
throw new UriNodePathException(senderNode + " is expected to be " + ownNode);
}
break;
}
}
Aggregations