Search in sources :

Example 1 with UriNodePathException

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;
    }
}
Also used : WonMessageDirection(won.protocol.message.WonMessageDirection) URI(java.net.URI) UriNodePathException(won.protocol.message.processor.exception.UriNodePathException)

Aggregations

URI (java.net.URI)1 WonMessageDirection (won.protocol.message.WonMessageDirection)1 UriNodePathException (won.protocol.message.processor.exception.UriNodePathException)1