@Override public boolean doAction(User user, HttpServletRequest request, HttpServletResponse response) throws Exception { CQSQueue queue = CQSControllerServlet.getCachedQueue(user, request); PersistenceFactory.getQueuePersistence().deleteQueue(queue.getRelativeUrl()); PersistenceFactory.getCQSMessagePersistence().clearQueue(queue.getRelativeUrl()); String out = CQSQueuePopulator.getDeleteQueueResponse(); response.getWriter().print(out); return true; }
@Override public boolean doAction(User user, HttpServletRequest request, HttpServletResponse response) throws Exception { CQSQueue queue = CQSControllerServlet.getCachedQueue(user, request); String ownerId = request.getParameter("QueueOwnerAWSAccountId"); if (ownerId == null) { ownerId = user.getUserId(); } if (!ownerId.equals(user.getUserId())) { CMBPolicy policy = new CMBPolicy(queue.getPolicy()); if (!policy.isAllowed(user, "CQS:" + this.actionName)) { throw new CMBException( CMBErrorCodes.AccessDenied, "You don't have permission for " + this.actionName); } } List<String> attributesList = Util.fillGetAttributesRequests(request); for (String attribute : attributesList) { if (!attribute.equals("All") && !attribute.equals(CQSConstants.VISIBILITY_TIMEOUT) && !attribute.equals(CQSConstants.POLICY) && !attribute.equals(CQSConstants.QUEUE_ARN) && !attribute.equals(CQSConstants.MAXIMUM_MESSAGE_SIZE) && !attribute.equals(CQSConstants.MESSAGE_RETENTION_PERIOD) && !attribute.equals(CQSConstants.DELAY_SECONDS) && !attribute.equals(CQSConstants.APPROXIMATE_NUMBER_OF_MESSAGES)) { throw new CMBException( CMBErrorCodes.InvalidAttributeName, "Unknown attribute " + attribute); } } String out = CQSQueuePopulator.getQueueAttributesResponse(queue, attributesList); response.getWriter().print(out); return true; }