public void unregisterExchange(AMQShortString name, boolean inUse) throws AMQException { // Check access if (!_host.getSecurityManager().authoriseDelete(_exchangeMap.get(name))) { throw new AMQSecurityException(); } // TODO: check inUse argument Exchange e = _exchangeMap.remove(name); _exchangeMapStr.remove(name.toString()); if (e != null) { if (e.isDurable()) { getDurableConfigurationStore().removeExchange(e); // tell Andes Kernel to remove exchange QpidAMQPBridge.getInstance().deleteExchange(e); } e.close(); } else { throw new AMQException("Unknown exchange " + name); } }
public static AMQQueue createAMQQueueImpl( String queueName, boolean durable, String owner, boolean autoDelete, boolean exclusive, VirtualHost virtualHost, Map<String, Object> arguments) throws AMQSecurityException { // Access check if (!virtualHost .getSecurityManager() .authoriseCreateQueue( autoDelete, durable, exclusive, null, null, new AMQShortString(queueName), owner)) { String description = "Permission denied: queue-name '" + queueName + "'"; throw new AMQSecurityException(description); } int priorities = 1; String conflationKey = null; if (arguments != null) { if (arguments.containsKey(QPID_LAST_VALUE_QUEUE) || arguments.containsKey(QPID_LAST_VALUE_QUEUE_KEY)) { conflationKey = (String) arguments.get(QPID_LAST_VALUE_QUEUE_KEY); if (conflationKey == null) { conflationKey = QPID_LVQ_KEY; } } else if (arguments.containsKey(X_QPID_PRIORITIES.toString())) { Object prioritiesObj = arguments.get(X_QPID_PRIORITIES.toString()); if (prioritiesObj instanceof Number) { priorities = ((Number) prioritiesObj).intValue(); } } } AMQQueue q; if (conflationKey != null) { q = new ConflationQueue( queueName, durable, owner, autoDelete, exclusive, virtualHost, arguments, conflationKey); } else if (priorities > 1) { q = new AMQPriorityQueue( queueName, durable, owner, autoDelete, exclusive, virtualHost, priorities, arguments); } else { q = new SimpleAMQQueue( queueName, durable, owner, autoDelete, exclusive, virtualHost, arguments); } // Register the new queue virtualHost.getQueueRegistry().registerQueue(q); q.configure(virtualHost.getConfiguration().getQueueConfiguration(queueName)); if (arguments != null) { for (QueueProperty p : DECLAREABLE_PROPERTIES) { if (arguments.containsKey(p.getArgumentName().toString())) { p.setPropertyValue(q, arguments.get(p.getArgumentName().toString())); } } } return q; }