return;
}
// I don't *think* that it make sense to allow setting exclusive or autoDelete to
// a queue created from config.
Queue queue = vhost.createQueue(nameParser.getQueueName(), State.ACTIVE, durable, false,
LifetimePolicy.PERMANENT, 0l, properties);
// Set the queue's alternateExchange, which is just a little bit involved......
// The queue.setAttribute() method needs an org.apache.qpid.server.model.Exchange instance
// not just a name, so we look up org.apache.qpid.server.qmf2.agentdata.Exchange by ID
// and get its associated org.apache.qpid.server.model.Exchange. We can do a look up by ID
// because we needed to use ObjectIds that were based on names in order to allow qpid-config
// to work, so we may as well make use of this convenience here too.
if (alternateExchange != null)
{
ObjectId objectId =
new ObjectId("", "org.apache.qpid.broker:exchange:" + alternateExchange, 0);
// Look up Exchange QmfAgentData by ObjectId from the Agent's internal Object store.
QmfAgentData object = agent.getObject(objectId);
if (object != null)
{
org.apache.qpid.server.qmf2.agentdata.Exchange ex =
(org.apache.qpid.server.qmf2.agentdata.Exchange)object;
Exchange altEx = ex.getExchange();
queue.setAttribute("alternateExchange", null, altEx);
}
}
}
else if (type.equals("binding")) // create binding.
{
Exchange exchange = nameParser.getExchange();
if (exchange == null)
{
agent.raiseException(handle, "Cannot create binding on Exchange " +
nameParser.getExchangeName());
return;
}
else
{
Map<String, Object> attributes = Collections.emptyMap();
exchange.createBinding(nameParser.getBindingKey(), nameParser.getQueue(),
properties, attributes);
}
}
agent.methodResponse(methodName, handle, outArgs, null);
}
catch (Exception e)
{
agent.raiseException(handle, e.getMessage());
}
}
else // method = delete
{
try
{
if (type.equals("exchange")) // delete exchange.
{
Exchange exchange = nameParser.getExchange();
if (exchange != null)
{
exchange.delete();
}
}
else if (type.equals("queue")) // delete queue.
{
Queue queue = nameParser.getQueue();
if (queue != null)
{
queue.delete();
}
}
else if (type.equals("binding")) // delete binding.
{
Binding binding = nameParser.getBinding();