1 18 package org.apache.activemq; 19 20 import java.util.Enumeration ; 21 import java.util.Hashtable ; 22 import java.util.regex.Matcher ; 23 import java.util.regex.Pattern ; 24 25 import javax.jms.ConnectionMetaData ; 26 27 31 32 public class ActiveMQConnectionMetaData implements ConnectionMetaData { 33 34 public static final String PROVIDER_VERSION; 35 public static final int PROVIDER_MAJOR_VERSION; 36 public static final int PROVIDER_MINOR_VERSION; 37 38 public static final ActiveMQConnectionMetaData INSTANCE = new ActiveMQConnectionMetaData(); 39 40 static { 41 String version=null; 42 int major=0; 43 int minor=0; 44 try { 45 Package p = Package.getPackage("org.apache.activemq"); 46 if (p != null) { 47 version = p.getImplementationVersion(); 48 Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*"); 49 Matcher m = pattern.matcher(version); 50 if( m.matches() ) { 51 major = Integer.parseInt(m.group(1)); 52 minor = Integer.parseInt(m.group(2)); 53 } 54 } 55 } catch ( Throwable e) { 56 } 57 PROVIDER_VERSION = version; 58 PROVIDER_MAJOR_VERSION = major; 59 PROVIDER_MINOR_VERSION = minor; 60 } 61 62 private ActiveMQConnectionMetaData() {} 63 64 69 70 public String getJMSVersion() { 71 return "1.1"; 72 } 73 74 79 80 public int getJMSMajorVersion() { 81 return 1; 82 } 83 84 89 90 public int getJMSMinorVersion() { 91 return 1; 92 } 93 94 99 100 public String getJMSProviderName() { 101 return "ActiveMQ"; 102 } 103 104 109 110 public String getProviderVersion() { 111 return PROVIDER_VERSION; 112 } 113 114 119 120 public int getProviderMajorVersion() { 121 return PROVIDER_MAJOR_VERSION; 122 } 123 124 129 130 public int getProviderMinorVersion() { 131 return PROVIDER_MINOR_VERSION; 132 } 133 134 139 140 public Enumeration getJMSXPropertyNames() { 141 Hashtable jmxProperties = new Hashtable (); 142 jmxProperties.put("JMSXGroupID", "1"); 143 jmxProperties.put("JMSXGroupSeq", "1"); 144 jmxProperties.put("JMSXDeliveryCount","1"); 145 return jmxProperties.keys(); 146 } 147 } 148 | Popular Tags |