Source Code Cross Referenced for JBossSession.java in  » EJB-Server-JBoss-4.2.1 » jms » org » jboss » jms » client » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » jms » org.jboss.jms.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.jms.client;
023:
024:        import java.io.Serializable;
025:
026:        import javax.jms.BytesMessage;
027:        import javax.jms.Destination;
028:        import javax.jms.JMSException;
029:        import javax.jms.MapMessage;
030:        import javax.jms.Message;
031:        import javax.jms.MessageConsumer;
032:        import javax.jms.MessageListener;
033:        import javax.jms.MessageProducer;
034:        import javax.jms.ObjectMessage;
035:        import javax.jms.Queue;
036:        import javax.jms.QueueBrowser;
037:        import javax.jms.QueueReceiver;
038:        import javax.jms.QueueSender;
039:        import javax.jms.QueueSession;
040:        import javax.jms.Session;
041:        import javax.jms.StreamMessage;
042:        import javax.jms.TemporaryQueue;
043:        import javax.jms.TemporaryTopic;
044:        import javax.jms.TextMessage;
045:        import javax.jms.Topic;
046:        import javax.jms.TopicPublisher;
047:        import javax.jms.TopicSession;
048:        import javax.jms.TopicSubscriber;
049:        import javax.jms.XAQueueSession;
050:        import javax.jms.XASession;
051:        import javax.jms.XATopicSession;
052:        import javax.transaction.xa.XAResource;
053:
054:        import org.jboss.jms.destination.JBossTemporaryDestination;
055:
056:        /**
057:         * A session
058:         * 
059:         * @author <a href="mailto:adrian@jboss.org>Adrian Brock</a>
060:         * @version $Revision: 57195 $
061:         */
062:        public class JBossSession implements  Session, QueueSession,
063:                TopicSession, XASession, XAQueueSession, XATopicSession {
064:            // Constants -----------------------------------------------------
065:
066:            /** The default message selector */
067:            private static String defaultSelector = null;
068:
069:            /** The default no local flag */
070:            private static boolean defaultNoLocal = false;
071:
072:            // Attributes ----------------------------------------------------
073:
074:            /** The delegate */
075:            private SessionDelegate delegate;
076:
077:            /** Whether this is an XASession */
078:            private boolean isXA;
079:
080:            /** The transacted flag */
081:            private boolean transacted;
082:
083:            /** The acknowledgement mode */
084:            private int acknowledgeMode;
085:
086:            /** The message listener */
087:            private MessageListener listener;
088:
089:            // Static --------------------------------------------------------
090:
091:            // Constructors --------------------------------------------------
092:
093:            // Public --------------------------------------------------------
094:
095:            /**
096:             * Construct a new JBossSession
097:             * 
098:             * @param delegate the session delegate
099:             * @param isXA whether the session is xa
100:             * @param transacted whether the session is transacted
101:             * @param acknowledgeMode the acknowledgement mode
102:             * @throws JMSException for any error
103:             */
104:            public JBossSession(SessionDelegate delegate, boolean isXA,
105:                    boolean transacted, int acknowledgeMode)
106:                    throws JMSException {
107:                this .delegate = delegate;
108:                this .isXA = isXA;
109:                this .transacted = transacted;
110:                this .acknowledgeMode = acknowledgeMode;
111:            }
112:
113:            // Session implementation ----------------------------------------
114:
115:            public void close() throws JMSException {
116:                delegate.closing();
117:                delegate.close();
118:            }
119:
120:            public void commit() throws JMSException {
121:                if (transacted == false)
122:                    throw new JMSException("Not a transacted session");
123:                delegate.commit();
124:            }
125:
126:            public QueueBrowser createBrowser(Queue queue,
127:                    String messageSelector) throws JMSException {
128:                if (queue == null)
129:                    throw new JMSException("Null queue");
130:                return new JBossBrowser(delegate.createBrowser(queue,
131:                        messageSelector), queue, messageSelector);
132:            }
133:
134:            public QueueBrowser createBrowser(Queue queue) throws JMSException {
135:                return createBrowser(queue, defaultSelector);
136:            }
137:
138:            public BytesMessage createBytesMessage() throws JMSException {
139:                return delegate.createBytesMessage();
140:            }
141:
142:            public MessageConsumer createConsumer(Destination destination,
143:                    String messageSelector, boolean noLocal)
144:                    throws JMSException {
145:                if (destination == null)
146:                    throw new JMSException("Null destination");
147:                return new JBossConsumer(delegate.createConsumer(destination,
148:                        null, messageSelector, noLocal), destination,
149:                        messageSelector, noLocal);
150:            }
151:
152:            public MessageConsumer createConsumer(Destination destination,
153:                    String messageSelector) throws JMSException {
154:                return createConsumer(destination, messageSelector,
155:                        defaultNoLocal);
156:            }
157:
158:            public MessageConsumer createConsumer(Destination destination)
159:                    throws JMSException {
160:                return createConsumer(destination, defaultSelector,
161:                        defaultNoLocal);
162:            }
163:
164:            public TopicSubscriber createDurableSubscriber(Topic topic,
165:                    String name, String messageSelector, boolean noLocal)
166:                    throws JMSException {
167:                if (topic == null)
168:                    throw new JMSException("Null topic");
169:                if (name == null)
170:                    throw new JMSException("Null subscription");
171:                return (TopicSubscriber) delegate.createConsumer(topic, name,
172:                        messageSelector, noLocal);
173:            }
174:
175:            public TopicSubscriber createDurableSubscriber(Topic topic,
176:                    String name) throws JMSException {
177:                return (TopicSubscriber) createDurableSubscriber(topic, name,
178:                        null, defaultNoLocal);
179:            }
180:
181:            public MapMessage createMapMessage() throws JMSException {
182:                return delegate.createMapMessage();
183:            }
184:
185:            public Message createMessage() throws JMSException {
186:                return delegate.createMessage();
187:            }
188:
189:            public ObjectMessage createObjectMessage() throws JMSException {
190:                return createObjectMessage(null);
191:            }
192:
193:            public ObjectMessage createObjectMessage(Serializable object)
194:                    throws JMSException {
195:                return delegate.createObjectMessage(object);
196:            }
197:
198:            public MessageProducer createProducer(Destination destination)
199:                    throws JMSException {
200:                return new JBossProducer(delegate.createProducer(destination),
201:                        destination);
202:            }
203:
204:            public Queue createQueue(String queueName) throws JMSException {
205:                return (Queue) delegate.getDestination(queueName);
206:            }
207:
208:            public StreamMessage createStreamMessage() throws JMSException {
209:                return delegate.createStreamMessage();
210:            }
211:
212:            public TemporaryQueue createTemporaryQueue() throws JMSException {
213:                return (TemporaryQueue) delegate
214:                        .createTempDestination(JBossTemporaryDestination.TEMPORARY_QUEUE);
215:            }
216:
217:            public TemporaryTopic createTemporaryTopic() throws JMSException {
218:                return (TemporaryTopic) delegate
219:                        .createTempDestination(JBossTemporaryDestination.TEMPORARY_TOPIC);
220:            }
221:
222:            public TextMessage createTextMessage() throws JMSException {
223:                return createTextMessage(null);
224:            }
225:
226:            public TextMessage createTextMessage(String text)
227:                    throws JMSException {
228:                return delegate.createTextMessage(text);
229:            }
230:
231:            public Topic createTopic(String topicName) throws JMSException {
232:                return (Topic) delegate.getDestination(topicName);
233:            }
234:
235:            public int getAcknowledgeMode() throws JMSException {
236:                return acknowledgeMode;
237:            }
238:
239:            public MessageListener getMessageListener() throws JMSException {
240:                return listener;
241:            }
242:
243:            public boolean getTransacted() throws JMSException {
244:                return transacted;
245:            }
246:
247:            public void recover() throws JMSException {
248:                delegate.recover();
249:            }
250:
251:            public void rollback() throws JMSException {
252:                if (transacted == false)
253:                    throw new JMSException("Not a transacted session");
254:                delegate.rollback();
255:            }
256:
257:            public void run() {
258:                if (listener == null)
259:                    throw new IllegalStateException("No message listener");
260:                delegate.run();
261:            }
262:
263:            public void setMessageListener(MessageListener listener)
264:                    throws JMSException {
265:                delegate.setMessageListener(listener);
266:                this .listener = listener;
267:            }
268:
269:            public void unsubscribe(String name) throws JMSException {
270:                delegate.unsubscribe(name);
271:            }
272:
273:            // XASession implementation --------------------------------------
274:
275:            public Session getSession() throws JMSException {
276:                return this ;
277:            }
278:
279:            public XAResource getXAResource() {
280:                if (isXA == false)
281:                    throw new IllegalArgumentException("Not an XASession");
282:                return delegate.getXAResource();
283:            }
284:
285:            // QueueSession implementation -----------------------------------
286:
287:            public QueueReceiver createReceiver(Queue queue,
288:                    String messageSelector) throws JMSException {
289:                return (QueueReceiver) createConsumer(queue, messageSelector);
290:            }
291:
292:            public QueueReceiver createReceiver(Queue queue)
293:                    throws JMSException {
294:                return (QueueReceiver) createConsumer(queue);
295:            }
296:
297:            public QueueSender createSender(Queue queue) throws JMSException {
298:                return (QueueSender) createProducer(queue);
299:            }
300:
301:            // TopicSession implementation -----------------------------------
302:
303:            public TopicSubscriber createSubscriber(Topic topic)
304:                    throws JMSException {
305:                return (TopicSubscriber) createConsumer(topic);
306:            }
307:
308:            public TopicSubscriber createSubscriber(Topic topic,
309:                    String messageSelector, boolean noLocal)
310:                    throws JMSException {
311:                return (TopicSubscriber) createConsumer(topic, messageSelector,
312:                        noLocal);
313:            }
314:
315:            public TopicPublisher createPublisher(Topic topic)
316:                    throws JMSException {
317:                return (TopicPublisher) createProducer(topic);
318:            }
319:
320:            // XAQueueSession implementation ---------------------------------
321:
322:            public QueueSession getQueueSession() throws JMSException {
323:                return (QueueSession) getSession();
324:            }
325:
326:            // XATopicSession implementation ---------------------------------
327:
328:            public TopicSession getTopicSession() throws JMSException {
329:                return (TopicSession) getSession();
330:            }
331:
332:            // Protected ------------------------------------------------------
333:
334:            // Package Private ------------------------------------------------
335:
336:            // Private --------------------------------------------------------
337:
338:            // Inner Classes --------------------------------------------------
339:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.