Here's the code I'm using:

  |     private void registerTopic(String topicname)
  |                     throws MalformedObjectNameException, Exception {
  |             createDestination("org.jboss.mq.server.jmx.Topic",
  |                             getTopicObjectName(topicname), "topic/" + 
topicname);
  |     }
  | 
  |     private ObjectName getTopicObjectName(String name)
  |                     throws MalformedObjectNameException {
  | 
  |             return new 
ObjectName("jboss.mq.destination:service=Topic,name=" + name);
  |     }
  | 
  |     protected void createDestination(String type, ObjectName name,
  |                     String jndiName) throws Exception {
  | 
  |             if (logger.isDebugEnabled()) {
  |                     logger.debug("Attempting to create destination: " + name
  |                                     + "; type=" + type);
  |             }
  |             MBeanServer server = MBeanServerLocator.locateJBoss();
  |             server.createMBean(type, name);
  |             server.setAttribute(name, new Attribute("DestinationManager",
  |                             new 
ObjectName("jboss.mq:service=DestinationManager")));
  |             
  |             server.setAttribute(name, new Attribute("SecurityManager",
  |                             new 
ObjectName("jboss.mq:service=SecurityManager")));
  |             
  |             server.setAttribute(name, new Attribute("SecurityConf", 
getSecurityconf()));
  |             server.setAttribute(name, new Attribute("JNDIName", jndiName));
  |             
  |             TopicMBean tmb = 
(TopicMBean)MBeanServerInvocationHandler.newProxyInstance(server, 
name,TopicMBean.class,false);
  |             tmb.start();
  |     }
  |     
  | 
  |     private Element getSecurityconf() throws SAXException, IOException{
  |             Element el = null;
  |             StringBuffer securityConfStr = new StringBuffer();
  |             securityConfStr.append("<security>");
  |             securityConfStr.append("  <role name=\"publisher\" 
read=\"true\" write=\"true\" create=\"false\"/>");
  |             securityConfStr.append("  <role name=\"durpublisher\" 
read=\"true\" write=\"true\" create=\"true\"/>");
  |             securityConfStr.append("</security>");
  | 
  |             DOMParser parser = new DOMParser(); 
  |             parser.parse(securityConfStr.toString());
  |             Document doc = parser.getDocument();
  |             el = doc.getDocumentElement();
  |             return el;
  |     }
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885953#3885953

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885953


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to