try
{
// configure the queue to allow "def" to read
String config = "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=Accounting");
ServerManagement.setAttribute(on, "SecurityConfig", config);
// configure the topic to prevent "def" from reading
config = "<security><role name=\"def\" read=\"false\" write=\"false\" create=\"false\"/></security>";
on = new ObjectName("jboss.messaging.destination:service=Topic,name=Accounting");
ServerManagement.setAttribute(on, "SecurityConfig", config);
Queue queue = (Queue)ic.lookup("/queue/Accounting");
Topic topic = (Topic)ic.lookup("/topic/Accounting");