I have been able to create a TopicMBean in code but i haven ot been able to get
access to it becuase I can not authenticate against it. I would imagine that
is becuase it doesn't have a SecurityConf. Here's what I did.
| 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;
| }
|
How ever I get the following Exception, no protocol [then is spits out the XML
I put in the Element].
Any help?
Michael
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885950#3885950
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885950
-------------------------------------------------------
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