1 55 56 package org.jboss.axis.components.jms; 57 58 import javax.jms.InvalidDestinationException ; 59 import javax.jms.JMSSecurityException ; 60 import javax.jms.Queue ; 61 import javax.jms.QueueConnectionFactory ; 62 import javax.jms.QueueSession ; 63 import javax.jms.Topic ; 64 import javax.jms.TopicConnectionFactory ; 65 import javax.jms.TopicSession ; 66 import java.util.HashMap ; 67 68 74 public abstract class JMSVendorAdapter 75 { 76 77 public static final int SEND_ACTION = 0; 78 public static final int CONNECT_ACTION = 1; 79 public static final int SUBSCRIBE_ACTION = 2; 80 public static final int RECEIVE_ACTION = 3; 81 public static final int ON_EXCEPTION_ACTION = 4; 82 83 public abstract QueueConnectionFactory getQueueConnectionFactory(HashMap cfProps) 84 throws Exception ; 85 86 public abstract TopicConnectionFactory getTopicConnectionFactory(HashMap cfProps) 87 throws Exception ; 88 89 public Queue getQueue(QueueSession session, String name) 90 throws Exception 91 { 92 return session.createQueue(name); 93 } 94 95 public Topic getTopic(TopicSession session, String name) 96 throws Exception 97 { 98 return session.createTopic(name); 99 } 100 101 102 public boolean isRecoverable(Throwable thrown, int action) 103 { 104 if (thrown instanceof RuntimeException || 105 thrown instanceof Error || 106 thrown instanceof JMSSecurityException || 107 thrown instanceof InvalidDestinationException ) 108 return false; 109 if (action == ON_EXCEPTION_ACTION) 110 return false; 111 return true; 112 } 113 114 } | Popular Tags |