Source Code Cross Referenced for JmsAdminForWSMQ.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_jms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2003 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         * 
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         * 
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         * 
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         */
021:        package org.objectweb.jonas_jms;
022:
023:        import java.util.Vector;
024:
025:        import javax.jms.ConnectionFactory;
026:        import javax.jms.Queue;
027:        import javax.jms.QueueConnectionFactory;
028:        import javax.jms.Topic;
029:        import javax.jms.TopicConnectionFactory;
030:        import javax.jms.XAConnectionFactory;
031:        import javax.jms.XAQueueConnectionFactory;
032:        import javax.jms.XATopicConnectionFactory;
033:        import javax.naming.InitialContext;
034:        import javax.naming.NamingException;
035:
036:        import org.objectweb.jonas_jms.api.JmsAdministration;
037:        import org.objectweb.util.monolog.api.BasicLevel;
038:
039:        /**
040:         * WebSphere MQ administration class.
041:         * <p>
042:         * This WebSphere MQ specific class implements the
043:         * <code>JmsAdministration</code> interface. It supposes that administration
044:         * is done in parallel within WebSphere MQ (such as creating a queue, 
045:         * creating and binding the corresponding JMS Queue, etc...).
046:         *
047:         * @author Frederic Maistre
048:         */
049:        public class JmsAdminForWSMQ implements  JmsAdministration {
050:
051:            private static String CONN_FACT_NAME = "JCF";
052:            private static String QUEUE_CONN_FACT_NAME = "JQCF";
053:            private static String TOPIC_CONN_FACT_NAME = "JTCF";
054:
055:            private InitialContext ictx = null;
056:            private Vector namelist = new Vector();
057:
058:            private XAConnectionFactory xacf = null;
059:            private XAQueueConnectionFactory xaqcf = null;
060:            private XATopicConnectionFactory xatcf = null;
061:            private ConnectionFactory jcf = null;
062:            private QueueConnectionFactory jqcf = null;
063:            private TopicConnectionFactory jtcf = null;
064:
065:            /**
066:             * Empty constructor.
067:             * <p>
068:             * Class created with <code>newInstance()</code>.
069:             */
070:            public JmsAdminForWSMQ() {
071:            }
072:
073:            /**
074:             * Initialization method, setting the connection factories.
075:             * <p>
076:             * WebSphere MQ never runs collocated.
077:             *
078:             * @param collocated  Not taken into account.
079:             * @param url  Not taken into account.
080:             *
081:             * @exception Exception  If creating a connection factory fails.
082:             */
083:            public void start(boolean collocated, String url) throws Exception {
084:
085:                // Creating an InitialContext.
086:                ictx = new InitialContext();
087:
088:                // Getting the connection factories that will be used by the
089:                // EJB components.
090:                try {
091:                    xacf = (XAConnectionFactory) ictx.lookup("wsmqXACF");
092:                    ictx.unbind("wsmqXACF");
093:                } catch (NamingException exc) {
094:                    TraceJms.logger
095:                            .log(BasicLevel.ERROR,
096:                                    "WebSphere MQ XAConnectionFactory could not be retrieved from JNDI");
097:                }
098:                try {
099:                    xaqcf = (XAQueueConnectionFactory) ictx.lookup("wsmqXAQCF");
100:                    ictx.unbind("wsmqXAQCF");
101:                } catch (NamingException exc) {
102:                    TraceJms.logger
103:                            .log(BasicLevel.ERROR,
104:                                    "WebSphere MQ XAQueueConnectionFactory could not be retrieved from JNDI");
105:                }
106:                try {
107:                    xatcf = (XATopicConnectionFactory) ictx.lookup("wsmqXATCF");
108:                    ictx.unbind("wsmqXATCF");
109:                } catch (NamingException exc) {
110:                    TraceJms.logger
111:                            .log(BasicLevel.ERROR,
112:                                    "WebSphere MQ XATopicConnectionFactory could not be retrieved from JNDI");
113:                }
114:
115:                // Getting the connection factories that will be used by pure
116:                // JMS clients.
117:                try {
118:                    ictx.lookup(CONN_FACT_NAME);
119:                    namelist.addElement(CONN_FACT_NAME);
120:                } catch (NamingException exc) {
121:                    TraceJms.logger
122:                            .log(BasicLevel.ERROR,
123:                                    "WebSphere MQ ConnectionFactory could not be retrieved from JNDI");
124:                }
125:                try {
126:                    ictx.lookup(QUEUE_CONN_FACT_NAME);
127:                    namelist.addElement(QUEUE_CONN_FACT_NAME);
128:                } catch (NamingException exc) {
129:                    TraceJms.logger
130:                            .log(BasicLevel.ERROR,
131:                                    "WebSphere MQ QueueConnectionFactory could not be retrieved from JNDI");
132:                }
133:                try {
134:                    ictx.lookup(TOPIC_CONN_FACT_NAME);
135:                    namelist.addElement(TOPIC_CONN_FACT_NAME);
136:                } catch (NamingException exc) {
137:                    TraceJms.logger
138:                            .log(BasicLevel.ERROR,
139:                                    "WebSphere MQ TopicConnectionFactory could not be retrieved from JNDI");
140:                }
141:            }
142:
143:            /**
144:             * Terminates the JMS Service.
145:             */
146:            public void stop() {
147:                // Cleaning up JNDI.
148:                try {
149:                    ictx.unbind(CONN_FACT_NAME);
150:                } catch (Exception ex) {
151:                }
152:                try {
153:                    ictx.unbind(QUEUE_CONN_FACT_NAME);
154:                } catch (Exception ex) {
155:                }
156:                try {
157:                    ictx.unbind(TOPIC_CONN_FACT_NAME);
158:                } catch (Exception ex) {
159:                }
160:
161:                if (TraceJms.isDebug())
162:                    TraceJms.logger.log(BasicLevel.DEBUG,
163:                            "connection factories unbound");
164:            }
165:
166:            /**
167:             * Returns the XAConnectionFactory.
168:             */
169:            public XAConnectionFactory getXAConnectionFactory() {
170:                return xacf;
171:            }
172:
173:            /**
174:             * Returns the XATopicConnectionFactory.
175:             */
176:            public XATopicConnectionFactory getXATopicConnectionFactory() {
177:                return xatcf;
178:            }
179:
180:            /**
181:             * Returns the XAQueueConnectionFactory.
182:             */
183:            public XAQueueConnectionFactory getXAQueueConnectionFactory() {
184:                return xaqcf;
185:            }
186:
187:            /**
188:             * Non implemented method: creating a WebSphere MQ destination from JOnAS is not possible.
189:             *
190:             * @exception Exception  Always thrown.
191:             */
192:            public Queue createQueue(String name) throws Exception {
193:                throw new Exception(
194:                        "WebSphere MQ Queue creation impossible from JOnAS");
195:            }
196:
197:            /**
198:             * Non implemented method: creating a WebSphere MQ destination from JOnAS is not possible.
199:             *
200:             * @exception Exception  Always thrown.
201:             */
202:            public Topic createTopic(String name) throws Exception {
203:                throw new Exception(
204:                        "WebSphere MQ Topic creation impossible from JOnAS");
205:            }
206:
207:            /**
208:             * Non implemented method: deleting a WebSphere MQ destination from JOnAS is not possible.
209:             *
210:             * @exception Exception  Always thrown.
211:             */
212:            public void deleteDestination(String name) throws Exception {
213:                throw new Exception(
214:                        "WebSphere MQ destination deletion impossible from JOnAS");
215:            }
216:
217:            /**
218:             * Returns -1; did not have time to find out if getting this information
219:             * is possible from a WSMQ Queue.
220:             */
221:            public int getPendingMessages(javax.jms.Queue queue)
222:                    throws Exception {
223:                return -1;
224:            }
225:
226:            /**
227:             * Returns -1; did not have time to find out if getting this information
228:             * is possible from a WSMQ Queue.
229:             */
230:            public int getPendingRequests(javax.jms.Queue queue)
231:                    throws Exception {
232:                return -1;
233:            }
234:
235:            /**
236:             * Returns -1; did not test the WSMQ Pub/Sub broker.
237:             */
238:            public int getSubscriptions(javax.jms.Topic topic) throws Exception {
239:                return -1;
240:            }
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.