public void exchangeBound(Session session, ExchangeBound method)
{
ExchangeBoundResult result = new ExchangeBoundResult();
VirtualHost virtualHost = getVirtualHost(session);
Exchange exchange;
AMQQueue queue;
if(method.hasExchange())
{
exchange = virtualHost.getExchange(method.getExchange());
if(exchange == null)
{
result.setExchangeNotFound(true);
}
}
else
{
exchange = virtualHost.getDefaultExchange();
}
if(method.hasQueue())
{
queue = getQueue(session, method.getQueue());
if(queue == null)
{
result.setQueueNotFound(true);
}
if(exchange != null && queue != null)
{
boolean queueMatched = exchange.isBound(queue);
result.setQueueNotMatched(!queueMatched);
if(method.hasBindingKey())
{
if(queueMatched)
{
final boolean keyMatched = exchange.isBound(method.getBindingKey(), queue);
result.setKeyNotMatched(!keyMatched);
if(method.hasArguments())
{
if(keyMatched)
{
result.setArgsNotMatched(!exchange.isBound(method.getBindingKey(), method.getArguments(), queue));
}
else
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments(), queue));
}
}
}
else
{
boolean keyMatched = exchange.isBound(method.getBindingKey());
result.setKeyNotMatched(!keyMatched);
if(method.hasArguments())
{
if(keyMatched)
{
result.setArgsNotMatched(!exchange.isBound(method.getBindingKey(), method.getArguments()));
}
else
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments()));
}
}
}
}
else if (method.hasArguments())
{
if(queueMatched)
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments(), queue));
}
else
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments()));
}
}
}
else if(exchange != null && method.hasBindingKey())
{
final boolean keyMatched = exchange.isBound(method.getBindingKey());
result.setKeyNotMatched(!keyMatched);
if(method.hasArguments())
{
if(keyMatched)
{
result.setArgsNotMatched(!exchange.isBound(method.getBindingKey(), method.getArguments()));
}
else
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments()));
}
}
}
}
else if(exchange != null && method.hasBindingKey())
{
final boolean keyMatched = exchange.isBound(method.getBindingKey());
result.setKeyNotMatched(!keyMatched);
if(method.hasArguments())
{
if(keyMatched)
{
result.setArgsNotMatched(!exchange.isBound(method.getBindingKey(), method.getArguments()));
}
else
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments()));
}
}
}
else if(exchange != null && method.hasArguments())
{
result.setArgsNotMatched(!exchange.isBound(method.getArguments()));
}
session.executionResult((int) method.getId(), result);