[CJ-dev] commonjava-projects/commonjava-enterprise-services/projects/jms-manager/src/main/java/org/c
Brought to you by:
johnqueso
From: John C. <joh...@co...> - 2004-04-08 15:32:45
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-enterprise-services/projects/jms-manager/src/main/java/org/commonjava/j2ee/services In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1684/projects/jms-manager/src/main/java/org/commonjava/j2ee/services Modified Files: JMSManager.java Added Files: DefaultJMSManager.java Log Message: refactored to provide an interface and default impl for each manager type, instead of merely a manager concrete impl. This will allow for easier mocking. --- NEW FILE: DefaultJMSManager.java --- /* Created on Mar 22, 2004 */ package org.commonjava.j2ee.services; import javax.jms.Queue; import javax.jms.QueueConnectionFactory; import javax.naming.NamingException; import javax.rmi.PortableRemoteObject; import org.commonjava.config.snapin.SnapInLoaderException; /** * @author jdcasey */ public final class DefaultJMSManager extends AbstractManager implements JMSManager{ /** * */ public DefaultJMSManager() { setJndiConfigName(STANDARD_JMS_JNDI_CONFIG_NAME); } public DefaultJMSManager(ServiceLocator locator){ super(locator); setJndiConfigName(STANDARD_JMS_JNDI_CONFIG_NAME); } public Queue getQueue(String jndiName) throws NamingException, SnapInLoaderException { Object result = getLocator().lookup(getJndiConfigName(), jndiName); // shouldn't have to do this, but just in case... if(result != null && !Queue.class.isInstance(result)){ result = PortableRemoteObject.narrow(result, Queue.class); } return (Queue)result; } public QueueConnectionFactory getQueueConnectionFactory(String jndiName) throws NamingException, SnapInLoaderException { Object result = getLocator().lookup(getJndiConfigName(), jndiName); // shouldn't have to do this, but just in case... if(result != null && !QueueConnectionFactory.class.isInstance(result)){ result = PortableRemoteObject.narrow(result, QueueConnectionFactory.class); } return (QueueConnectionFactory)result; } } Index: JMSManager.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-enterprise-services/projects/jms-manager/src/main/java/org/commonjava/j2ee/services/JMSManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JMSManager.java 23 Mar 2004 14:58:59 -0000 1.1 +++ JMSManager.java 8 Apr 2004 15:19:35 -0000 1.2 @@ -1,56 +1,26 @@ -/* Created on Mar 22, 2004 */ +/* + * Created on Apr 8, 2004 + * + */ package org.commonjava.j2ee.services; import javax.jms.Queue; import javax.jms.QueueConnectionFactory; import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; import org.commonjava.config.snapin.SnapInLoaderException; - -/** - * @author jdcasey +//TODO: Add JavaDoc to JMSManager in commonjava-enterprise-services! +/** + * + * @ + * */ -public final class JMSManager extends AbstractManager{ - +public interface JMSManager { public static final String STANDARD_JMS_JNDI_CONFIG_NAME = "jms"; - - /** - * - */ - public JMSManager() { - setJndiConfigName(STANDARD_JMS_JNDI_CONFIG_NAME); - } - - public JMSManager(ServiceLocator locator){ - super(locator); - setJndiConfigName(STANDARD_JMS_JNDI_CONFIG_NAME); - } - - public Queue getQueue(String jndiName) throws NamingException, SnapInLoaderException - { - Object result = getLocator().lookup(getJndiConfigName(), jndiName); - - // shouldn't have to do this, but just in case... - if(result != null && !Queue.class.isInstance(result)){ - result = PortableRemoteObject.narrow(result, Queue.class); - } - - return (Queue)result; - } - - public QueueConnectionFactory getQueueConnectionFactory(String jndiName) - throws NamingException, SnapInLoaderException - { - Object result = getLocator().lookup(getJndiConfigName(), jndiName); - - // shouldn't have to do this, but just in case... - if(result != null && !QueueConnectionFactory.class.isInstance(result)){ - result = PortableRemoteObject.narrow(result, QueueConnectionFactory.class); - } - - return (QueueConnectionFactory)result; - } -} + public abstract Queue getQueue(String jndiName) + throws NamingException, SnapInLoaderException; + public abstract QueueConnectionFactory getQueueConnectionFactory(String jndiName) + throws NamingException, SnapInLoaderException; +} \ No newline at end of file |