View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jms;
8   
9   import org.apache.commons.logging.Log;
10  import org.apache.commons.logging.LogFactory;
11  
12  import javax.jms.*;
13  import java.io.Serializable;
14  
15  public class ReusableSessionWrapper implements Session
16  {
17      protected transient Log logger = LogFactory.getLog(getClass());
18  
19      private Session delegateSession;
20  
21      public ReusableSessionWrapper(Session delegateSession)
22      {
23          this.delegateSession = delegateSession;
24      }
25  
26      public BytesMessage createBytesMessage() throws JMSException
27      {
28          return delegateSession.createBytesMessage();
29      }
30  
31      public MapMessage createMapMessage() throws JMSException
32      {
33          return delegateSession.createMapMessage();
34      }
35  
36      public Message createMessage() throws JMSException
37      {
38          return delegateSession.createMessage();
39      }
40  
41      public ObjectMessage createObjectMessage() throws JMSException
42      {
43          return delegateSession.createObjectMessage();
44      }
45  
46      public ObjectMessage createObjectMessage(Serializable object) throws JMSException
47      {
48          return delegateSession.createObjectMessage(object);
49      }
50  
51      public StreamMessage createStreamMessage() throws JMSException
52      {
53          return delegateSession.createStreamMessage();
54      }
55  
56      public TextMessage createTextMessage() throws JMSException
57      {
58          return delegateSession.createTextMessage();
59      }
60  
61      public TextMessage createTextMessage(String text) throws JMSException
62      {
63          return delegateSession.createTextMessage(text);
64      }
65  
66      public boolean getTransacted() throws JMSException
67      {
68          return delegateSession.getTransacted();
69      }
70  
71      public int getAcknowledgeMode() throws JMSException
72      {
73          return delegateSession.getAcknowledgeMode();
74      }
75  
76      public void commit() throws JMSException
77      {
78          delegateSession.commit();
79      }
80  
81      public void rollback() throws JMSException
82      {
83          delegateSession.rollback();
84      }
85  
86      public void close() throws JMSException
87      {
88          //Do nothing, reuse it
89      }
90  
91      public void recover() throws JMSException
92      {
93          delegateSession.recover();
94      }
95  
96      public MessageListener getMessageListener() throws JMSException
97      {
98          return delegateSession.getMessageListener();
99      }
100 
101     public void setMessageListener(MessageListener listener) throws JMSException
102     {
103         delegateSession.setMessageListener(listener);
104     }
105 
106     public void run()
107     {
108         delegateSession.run();
109     }
110 
111     public MessageProducer createProducer(Destination destination) throws JMSException
112     {
113         return delegateSession.createProducer(destination);
114     }
115 
116     public MessageConsumer createConsumer(Destination destination) throws JMSException
117     {
118         return delegateSession.createConsumer(destination);
119     }
120 
121     public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException
122     {
123         return delegateSession.createConsumer(destination, messageSelector);
124     }
125 
126     public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal) throws JMSException
127     {
128         return delegateSession.createConsumer(destination, messageSelector, NoLocal);
129     }
130 
131     public Queue createQueue(String queueName) throws JMSException
132     {
133         return delegateSession.createQueue(queueName);
134     }
135 
136     public Topic createTopic(String topicName) throws JMSException
137     {
138         return delegateSession.createTopic(topicName);
139     }
140 
141     public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException
142     {
143         return delegateSession.createDurableSubscriber(topic, name);
144     }
145 
146     public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal) throws JMSException
147     {
148         return delegateSession.createDurableSubscriber(topic, name, messageSelector, noLocal);
149     }
150 
151     public QueueBrowser createBrowser(Queue queue) throws JMSException
152     {
153         return delegateSession.createBrowser(queue);
154     }
155 
156     public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException
157     {
158         return delegateSession.createBrowser(queue, messageSelector);
159     }
160 
161     public TemporaryQueue createTemporaryQueue() throws JMSException
162     {
163         return delegateSession.createTemporaryQueue();
164     }
165 
166     public TemporaryTopic createTemporaryTopic() throws JMSException
167     {
168         return delegateSession.createTemporaryTopic();
169     }
170 
171     public void unsubscribe(String name) throws JMSException
172     {
173         delegateSession.unsubscribe(name);
174     }
175 }