Package org.wso2.carbon.messagebox

Examples of org.wso2.carbon.messagebox.MessageBoxException


        String permissionLabelResourcePath = getMessageBoxResourcePath(messageBoxId) + "/" + permissionLabel;
        try {
            UserRegistry userRegistry = Utils.getUserRegistry();
            userRegistry.delete(permissionLabelResourcePath);
        } catch (RegistryException e) {
            throw new MessageBoxException("Can not access the registry", e);
        }
    }
View Full Code Here


                                                      Arrays.asList(operations));
                permissionList.add(permissionLabel);
            }
            return permissionList;
        } catch (RegistryException e) {
            throw new MessageBoxException("Can not find resources in the registry", e);
        }

    }
View Full Code Here

                    "\\" + MessageBoxConstants.JMS_MESSAGE_SHARED_USER_OPERATION_SEPARATOR);

            return new PermissionLabel(permissionLabel, Arrays.asList(sharedUsers),
                                       Arrays.asList(operations));
        } catch (RegistryException e) {
            throw new MessageBoxException("Can not find the resource in " + permissionLabelResourcePath, e);
        }
    }
View Full Code Here

                    return userCollection.getProperty(accessKeyId);
                }
            }
            return null;
        } catch (org.wso2.carbon.registry.api.RegistryException e) {
            throw new MessageBoxException("Failed to get secret id of user " + accessKeyId);
        }
    }
View Full Code Here

                    this.queueAttributes.put(attributeName, attributeValue);
                } else {
                    if (log.isWarnEnabled()) {
                        log.warn(attributeName + " attribute value can not be null.");
                    }
                    throw new MessageBoxException( "InvalidAttributeValue ", "Unknown attributeValue ");
                }
            } else {
                if (log.isWarnEnabled()) {
                    log.warn(attributeName + " attribute is not supported.");
                }
                throw new MessageBoxException("InvalidAttributeName ", "Unknown attribute ");
            }
        }
    }
View Full Code Here

        String username = getCurrentUser();
        if (!(Utils.isAdmin(username) || isMessageBoxOwner(messageBoxId, username) ||
              authorizationHandler.isUserAuthorized(username,
                                                    messageBoxId,
                                                    MessageBoxConstants.SQS_OPERATION_RECEIVE_MESSAGE))) {
            throw new MessageBoxException("AccessDenied");
        }

        if (!registryMessageBoxHandler.isMessageBoxExists(messageBoxId)) {
            throw new MessageBoxException("AWS.SimpleQueueService.NonExistentQueue");
        }

        try {
            List<Message> jmsMessageList = JMSQueueHandler.browse(messageBoxId);

            MessageDetails[] messageDetailsArray = new MessageDetails[jmsMessageList.size()];
            int index = 0;
            for (Message jmsMessage : jmsMessageList) {
                messageDetailsArray[index++] = jmsMessageToMessageDetails(jmsMessage);
            }

            return messageDetailsArray;
        } catch (JMSQueueHandlerException e) {
            throw new MessageBoxException("InternalError", e);
        }
    }
View Full Code Here

        String username = getCurrentUser();
        if (!(Utils.isAdmin(username) || isMessageBoxOwner(messageBoxId, username) ||
              authorizationHandler.isUserAuthorized(username,
                                                    messageBoxId,
                                                    MessageBoxConstants.SQS_OPERATION_RECEIVE_MESSAGE))) {
            throw new MessageBoxException("AccessDenied");
        }

        if (!registryMessageBoxHandler.isMessageBoxExists(messageBoxId)) {
            throw new MessageBoxException("AWS.SimpleQueueService.NonExistentQueue");
        }

        List<MessageDetails> messageDetailsList = new ArrayList<MessageDetails>();
        MessageDetails messageDetails;
        for (MessageLock messageLock : getMessageLocks().values()) {
View Full Code Here

        String username = getCurrentUser();
        if (!(Utils.isAdmin(username) || isMessageBoxOwner(messageBoxId, username) ||
              authorizationHandler.isUserAuthorized(username,
                                                    messageBoxId,
                                                    MessageBoxConstants.SQS_OPERATION_RECEIVE_MESSAGE))) {
            throw new MessageBoxException("AccessDenied");
        }
        return registryMessageBoxHandler.getAllPermissions(messageBoxId);
    }
View Full Code Here

            MessageBoxDetails messageBoxDetails =
                    registryMessageBoxHandler.getMessageBoxDetails(
                            username + "/" + messageBoxName);

            if (messageBoxDetails.getDefaultVisibilityTimeout() != defaultVisibilityTimeout) {
                throw new MessageBoxException("message box already exists with the name, "
                                              + messageBoxName + " for user " + username);
            }
        } else {
            // message box does not exists
            registryMessageBoxHandler.createMessageBox(
View Full Code Here

        //ToDo:We have to wait 60 seconds to create message box on same name after deleting?

        // Only an admin or the owner can delete a message box
        String username = getCurrentUser();
        if (!Utils.isAdmin(username) && !isMessageBoxOwner(messageBoxId, username)) {
            throw new MessageBoxException("AccessDenied");
        }

        if (!registryMessageBoxHandler.isMessageBoxExists(messageBoxId)) {
            throw new MessageBoxException("AWS.SimpleQueueService.NonExistentQueue");
        }

        try {
            JMSQueueHandler.clearQueue(messageBoxId);
        } catch (JMSQueueHandlerException e) {
            throw new MessageBoxException("InternalError", e);
        }

        // Remove permissions attached to this message box
        List<PermissionLabel> permissionLabels =
                registryMessageBoxHandler.getAllPermissions(messageBoxId);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.messagebox.MessageBoxException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.