1 17 18 package org.apache.geronimo.console.jmsmanager; 19 20 import java.util.Map ; 21 22 import javax.jms.Queue ; 23 import javax.jms.Topic ; 24 25 import org.apache.geronimo.gbean.AbstractName; 26 import org.apache.geronimo.gbean.AbstractNameQuery; 27 import org.apache.geronimo.gbean.GBeanData; 28 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 29 import org.apache.geronimo.kernel.GBeanNotFoundException; 30 import org.apache.geronimo.kernel.Kernel; 31 import org.apache.geronimo.kernel.KernelRegistry; 32 import org.apache.geronimo.kernel.config.Configuration; 33 import org.apache.geronimo.kernel.config.ConfigurationManager; 34 import org.apache.geronimo.kernel.config.ConfigurationUtil; 35 import org.apache.geronimo.kernel.repository.Artifact; 36 37 public abstract class AbstractJMSManager { 38 39 protected static final Artifact ACTIVEMQ_BROKER_ARTIFACT = new Artifact("geronimo", "activemq-broker", org.apache.geronimo.system.serverinfo.ServerConstants.getVersion(), "car"); 40 protected static final Artifact ACTIVEMQ_ARTIFACT = new Artifact("geronimo", "activemq", org.apache.geronimo.system.serverinfo.ServerConstants.getVersion(), "car"); 41 protected static final Kernel kernel = KernelRegistry.getSingleKernel(); 42 43 protected static final ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel); 44 protected final Configuration BROKER_CONFIGURATION = configurationManager.getConfiguration(ACTIVEMQ_BROKER_ARTIFACT); 45 protected final Configuration CONNECTOR_CONFIGURATION = configurationManager.getConfiguration(ACTIVEMQ_ARTIFACT); 46 47 private static final AbstractName earName = kernel.getNaming().createRootName(ACTIVEMQ_ARTIFACT, NameFactory.NULL, NameFactory.J2EE_APPLICATION); 48 protected static final AbstractName RESOURCE_ADAPTER_MODULE_NAME = kernel.getNaming().createChildName(earName, ACTIVEMQ_ARTIFACT.toString(), NameFactory.RESOURCE_ADAPTER_MODULE); 49 protected static final AbstractName RESOURCE_ADAPTER_NAME = kernel.getNaming().createChildName(RESOURCE_ADAPTER_MODULE_NAME, ACTIVEMQ_ARTIFACT.toString(), NameFactory.RESOURCE_ADAPTER); 50 protected static final AbstractName JCA_RESOURCE_NAME = kernel.getNaming().createChildName(RESOURCE_ADAPTER_NAME, ACTIVEMQ_ARTIFACT.toString(), NameFactory.JCA_RESOURCE); 51 protected static final AbstractName JCA_CONNECTION_FACTORY_NAME = kernel.getNaming().createChildName(JCA_RESOURCE_NAME, "DefaultActiveMQConnectionFactory", NameFactory.JCA_CONNECTION_FACTORY); 52 protected static final AbstractName JCA_MANAGED_CONNECTION_FACTORY_NAME = kernel.getNaming().createChildName(JCA_CONNECTION_FACTORY_NAME, "DefaultActiveMQConnectionFactory", NameFactory.JCA_MANAGED_CONNECTION_FACTORY); 53 54 55 protected static final String GET_BROKER_ADMIN_FUNCTION = "getBrokerAdmin"; 56 57 public static final String TOPIC_TYPE = "Topic"; 58 59 public static final String QUEUE_TYPE = "Queue"; 60 61 protected static final String DESTINATION_LIST = "destinations"; 63 64 protected static final String DESTINATION_MSG = "destinationsMsg"; 65 66 protected static final String DESTINATION_NAME = "destinationMessageDestinationName"; 68 69 protected static final String DESTINATION_PHYSICAL_NAME = "destinationPhysicalName"; 70 71 protected static final String DESTINATION_TYPE = "destinationType"; 72 73 protected static final String DESTINATION_APPLICATION_NAME = "destinationApplicationName"; 74 75 protected static final String DESTINATION_MODULE_NAME = "destinationModuleName"; 76 77 protected static final String DESTINATION_CONFIG_URI = "destinationConfigURI"; 78 79 protected static Object [] no_args = new Object [0]; 80 81 protected static String [] no_params = new String [0]; 82 83 84 protected static final String BASE_CONFIG_URI = "runtimedestination/"; 85 86 protected GBeanData getResourceAdapterModuleData() throws GBeanNotFoundException { 87 return CONNECTOR_CONFIGURATION.findGBeanData(new AbstractNameQuery(RESOURCE_ADAPTER_MODULE_NAME)); 88 } 89 90 protected GBeanData getQueueGBeanData() throws GBeanNotFoundException { 91 GBeanData moduleData = getResourceAdapterModuleData(); 92 Map adminObjects = (Map ) moduleData.getAttribute("adminObjectInfoMap"); 93 GBeanData queueData = (GBeanData) adminObjects.get(Queue .class.getName()); 94 return new GBeanData(queueData); 95 } 96 97 protected GBeanData getTopicGBeanData() throws GBeanNotFoundException { 98 GBeanData moduleData = getResourceAdapterModuleData(); 99 Map adminObjects = (Map ) moduleData.getAttribute("adminObjectInfoMap"); 100 GBeanData queueData = (GBeanData) adminObjects.get(Topic .class.getName()); 101 return new GBeanData(queueData); 102 } 103 104 106 108 110 112 141 156 } 157 | Popular Tags |