1 package org.objectweb.jtests.providers.admin; 2 3 import org.objectweb.jtests.jms.admin.Admin; 4 5 import javax.naming.*; 6 import javax.jms.Queue ; 7 import javax.jms.Topic ; 8 import java.util.*; 9 import java.io.*; 10 import com.pramati.services.jms.spi.admin.JMSServerMBean; 11 import com.pramati.util.naming.BindNamesAndDefaultParamValues; 12 13 27 public class PramatiAdmin implements Admin { 28 29 private String name = "PRAMATI"; 30 InitialContext ictx = null; 31 JMSServerMBean jmsServerMBean = null; 32 36 public PramatiAdmin() { 37 try { 38 Properties props = new Properties(); 39 props.setProperty("java.naming.factory.initial", 40 "com.pramati.naming.client.PramatiClientContextFactory"); 41 props.setProperty("java.naming.provider.url", "http://localhost:2099"); 45 ictx = new InitialContext (props); 46 jmsServerMBean = (JMSServerMBean)ictx.lookup(BindNamesAndDefaultParamValues.JMS_SERVER_MBEAN); 47 }catch (Exception e) { 48 e.printStackTrace(); 49 } 50 } 51 52 public String getName() { 53 return name; 54 } 55 56 public InitialContext createInitialContext() throws NamingException { 57 return ictx; 58 } 59 60 public void createQueueConnectionFactory(String name) { 61 try { 62 jmsServerMBean.createQueueConnectionFactory(name); 63 } catch (Exception e) { 64 e.printStackTrace(); 65 } 66 } 67 68 public void createTopicConnectionFactory(String name) { 69 try { 70 jmsServerMBean.createTopicConnectionFactory(name); 71 } catch (Exception e) { 72 e.printStackTrace(); 73 } 74 } 75 76 public void createQueue(String name) { 77 try { 78 jmsServerMBean.createQueue(name); 79 } catch (Exception e) { 80 e.printStackTrace(); 81 } 82 } 83 84 public void createTopic(String name) { 85 try { 86 jmsServerMBean.createTopic(name); 87 } catch (Exception e) { 88 e.printStackTrace(); 89 } 90 } 91 92 public void deleteQueue(String name) { 93 try { 94 jmsServerMBean.deleteQueue(name); 95 } catch (Exception e) { 96 e.printStackTrace(); 97 } 98 } 99 100 public void deleteTopic(String name) { 101 try { 102 jmsServerMBean.deleteTopic(name); 103 } catch (Exception e) { 104 e.printStackTrace(); 105 } 106 } 107 108 public void deleteTopicConnectionFactory(String name) { 109 try { 110 jmsServerMBean.deleteTopicConnectionFactory(name); 111 } catch (Exception e) { 112 e.printStackTrace(); 113 } 114 } 115 116 public void deleteQueueConnectionFactory(String name) { 117 try { 118 jmsServerMBean.deleteQueueConnectionFactory(name); 119 } catch (Exception e) { 120 e.printStackTrace(); 121 } 122 } 123 } 124 | Popular Tags |