Source Code Cross Referenced for DwrConnection.java in  » Ajax » dwr » org » directwebremoting » jms » 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 » Ajax » dwr » org.directwebremoting.jms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.directwebremoting.jms;
017:
018:        import javax.jms.Connection;
019:        import javax.jms.ConnectionConsumer;
020:        import javax.jms.Destination;
021:        import javax.jms.ExceptionListener;
022:        import javax.jms.JMSException;
023:        import javax.jms.ServerSessionPool;
024:        import javax.jms.Session;
025:        import javax.jms.Topic;
026:        import javax.servlet.ServletContext;
027:
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:
031:        /**
032:         * An implementation of {@link Connection} for DWR
033:         * @author Joe Walker [joe at getahead dot ltd dot uk]
034:         */
035:        public class DwrConnection implements  Connection {
036:            /**
037:             * Simple setup
038:             */
039:            public DwrConnection() {
040:            }
041:
042:            /* (non-Javadoc)
043:             * @see javax.jms.Connection#createSession(boolean, int)
044:             */
045:            public DwrSession createSession(boolean transacted,
046:                    int acknowledgeMode) throws JMSException {
047:                if (transacted != false) {
048:                    log.error("transacted == true is not currently supported");
049:                }
050:
051:                if (acknowledgeMode != Session.AUTO_ACKNOWLEDGE) {
052:                    log
053:                            .error("acknowledgeMode != Session.AUTO_ACKNOWLEDGE is not currently supported");
054:                }
055:
056:                return new DwrSession(this , transacted, acknowledgeMode);
057:            }
058:
059:            /* (non-Javadoc)
060:             * @see javax.jms.Connection#createConnectionConsumer(javax.jms.Destination, java.lang.String, javax.jms.ServerSessionPool, int)
061:             */
062:            public ConnectionConsumer createConnectionConsumer(
063:                    Destination destination, String messageSelector,
064:                    ServerSessionPool sessionPool, int maxMessages)
065:                    throws JMSException {
066:                throw Unsupported.noConnectionConsumers();
067:            }
068:
069:            /* (non-Javadoc)
070:             * @see javax.jms.Connection#createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int)
071:             */
072:            public ConnectionConsumer createDurableConnectionConsumer(
073:                    Topic topic, String subscriptionName,
074:                    String messageSelector, ServerSessionPool sessionPool,
075:                    int maxMessages) throws JMSException {
076:                throw Unsupported.noConnectionConsumers();
077:            }
078:
079:            /* (non-Javadoc)
080:             * @see javax.jms.Connection#getMetaData()
081:             */
082:            public DwrConnectionMetaData getMetaData() throws JMSException {
083:                return new DwrConnectionMetaData();
084:            }
085:
086:            /* (non-Javadoc)
087:             * @see javax.jms.Connection#start()
088:             */
089:            public void start() throws JMSException {
090:                if (state == State.CLOSED) {
091:                    throw new JMSException("Connection has been closed");
092:                }
093:
094:                state = State.STARTED;
095:            }
096:
097:            /* (non-Javadoc)
098:             * @see javax.jms.Connection#stop()
099:             */
100:            public void stop() throws JMSException {
101:                if (state == State.CLOSED) {
102:                    throw new JMSException("Connection has been closed");
103:                }
104:
105:                state = State.STOPPED;
106:            }
107:
108:            /* (non-Javadoc)
109:             * @see javax.jms.Connection#close()
110:             */
111:            public void close() throws JMSException {
112:                state = State.CLOSED;
113:            }
114:
115:            /* (non-Javadoc)
116:             * @see javax.jms.Connection#setClientID(java.lang.String)
117:             */
118:            public void setClientID(String clientId) throws JMSException {
119:                this .clientId = clientId;
120:            }
121:
122:            /* (non-Javadoc)
123:             * @see javax.jms.Connection#getClientID()
124:             */
125:            public String getClientID() throws JMSException {
126:                return clientId;
127:            }
128:
129:            /* (non-Javadoc)
130:             * @see javax.jms.Connection#setExceptionListener(javax.jms.ExceptionListener)
131:             */
132:            public void setExceptionListener(ExceptionListener listener)
133:                    throws JMSException {
134:                this .listener = listener;
135:            }
136:
137:            /* (non-Javadoc)
138:             * @see javax.jms.Connection#getExceptionListener()
139:             */
140:            public ExceptionListener getExceptionListener() throws JMSException {
141:                return listener;
142:            }
143:
144:            /**
145:             * Children need to know if they can send messages.
146:             * @return Has {@link Connection#start()} been called
147:             */
148:            public State getState() {
149:                return state;
150:            }
151:
152:            /**
153:             * @return the servletContext
154:             */
155:            public ServletContext getServletContext() {
156:                return servletContext;
157:            }
158:
159:            /**
160:             * @param servletContext the servletContext to set
161:             */
162:            public void setServletContext(ServletContext servletContext) {
163:                this .servletContext = servletContext;
164:            }
165:
166:            /**
167:             * Our connection to the DWR infrastructure
168:             */
169:            private ServletContext servletContext;
170:
171:            /**
172:             * What's the current state of the current connection?
173:             */
174:            private State state = State.STOPPED;
175:
176:            /**
177:             * The ID of this client
178:             */
179:            private String clientId;
180:
181:            /**
182:             * If something goes wrong we call this
183:             */
184:            private ExceptionListener listener;
185:
186:            /**
187:             * The log stream
188:             */
189:            private static final Log log = LogFactory
190:                    .getLog(DwrConnection.class);
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.