KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > walend > somnifugi > SomniJNDIBypass


1 package net.walend.somnifugi;
2
3 import java.util.Set JavaDoc;
4
5 /**
6 SomniJNDIBypass is an alternative to using JNDI with Somnifugi. It is a singleton accessible via the static constant IT. Use IT to get a QueueConnectionFactory, a TopicConnectionFactory, and to access and create new Queues and Topics.
7
8 @author <a HREF="http://walend.net">David Walend</a> <a HREF="mailto:david@walend.net">david@walend.net</a>
9  */

10
11 public class SomniJNDIBypass
12 {
13     private static final String JavaDoc SOMNIJNDIBYPASSQUEUECONTEXTNAME = "SomniJNDIBypassQueue";
14     private static final String JavaDoc SOMNIJNDIBYPASSTOPICCONTEXTNAME = "SomniJNDIBypassTopic";
15
16     public static final SomniJNDIBypass IT = new SomniJNDIBypass();
17
18     private final SomniQueueContext queueContext = new SomniQueueContext(SOMNIJNDIBYPASSQUEUECONTEXTNAME,System.getProperties());
19     private final SomniQueueConnectionFactory queueConnectionFactory = new SomniQueueConnectionFactory();
20
21     private final SomniTopicContext topicContext = new SomniTopicContext(SOMNIJNDIBYPASSTOPICCONTEXTNAME,System.getProperties());
22     private final SomniTopicConnectionFactory topicConnectionFactory = new SomniTopicConnectionFactory();
23
24     private SomniJNDIBypass()
25     {
26     }
27
28     public SomniQueueContext getQueueContext()
29     {
30         return queueContext;
31     }
32
33     public SomniTopicContext getTopicContext()
34     {
35         return topicContext;
36     }
37
38     public SomniQueueConnectionFactory getQueueConnectionFactory()
39     {
40         return queueConnectionFactory;
41     }
42
43     public SomniTopicConnectionFactory getTopicConnectionFactory()
44     {
45         return topicConnectionFactory;
46     }
47
48     public SomniQueue getQueue(String JavaDoc key)
49         throws SomniNamingException
50     {
51         return SomniQueueCache.IT.getQueue(key,queueContext);
52     }
53
54     public boolean containsQueue(String JavaDoc key)
55     {
56         return SomniQueueCache.IT.containsQueue(key);
57     }
58
59     public Set JavaDoc<String JavaDoc> getQueueNames()
60     {
61         return SomniQueueCache.IT.getNames();
62     }
63
64     public SomniTopic getTopic(String JavaDoc key)
65         throws SomniNamingException
66     {
67         return SomniTopicCache.IT.getTopic(key,topicContext);
68     }
69
70     public boolean containsTopic(String JavaDoc key)
71     {
72         return SomniTopicCache.IT.containsTopic(key);
73     }
74
75     public Set JavaDoc<String JavaDoc> getTopicNames()
76     {
77         return SomniTopicCache.IT.getNames();
78     }
79
80 }
81
82 /* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 David Walend
83 All rights reserved.
84
85 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
86
87 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
88
89 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
90
91 Neither the name of the SomnifugiJMS Project, walend.net, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission from David Walend.
92
93 Credits in redistributions in source or binary forms must include a link to http://somnifugi.sourceforge.net .
94
95 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96 The net.walend.somnifugi.sql92 package is modified code from the openmq project, https://mq.dev.java.net/ , Copyright (c) of Sun, and carries the CDDL license, repeated here: You can obtain a copy of the license at https://glassfish.dev.java.net/public/CDDLv1.0.html. See the License for the specific language governing permissions and limitations under the License.
97
98 =================================================================================
99
100 For more information and the latest version of this software, please see http://somnifugi.sourceforge.net and http://walend.net or email <a HREF="mailto:david@walend.net">david@walend.net</a>.
101  */

102
Popular Tags