01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)IMQConnectionHelper.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: package com.sun.jbi.binding.proxy.jms;
30:
31: import com.sun.jbi.binding.proxy.connection.ConnectionHelper;
32: import com.sun.jbi.binding.proxy.connection.ConnectionException;
33:
34: import com.sun.messaging.TopicConnectionFactory;
35:
36: import javax.jms.ConnectionFactory;
37: import javax.jms.Queue;
38: import javax.jms.Topic;
39:
40: /**
41: * Helper for ConnectionManagers
42: * @author Sun Microsystems, Inc
43: */
44: public class IMQConnectionHelper implements ConnectionHelper {
45: String mHost;
46: String mPort;
47:
48: public IMQConnectionHelper(String host, String port) {
49: mHost = host;
50: mPort = port;
51: }
52:
53: public void prepare() {
54:
55: }
56:
57: /**
58: * Return a JMS ConnectionFactory.
59: * @return ConnectionFactory
60: */
61: public ConnectionFactory getConnectionFactory()
62: throws ConnectionException {
63: try {
64: TopicConnectionFactory tCF = new com.sun.messaging.TopicConnectionFactory();
65: tCF.setProperty("imqBrokerHostPort", mPort);
66: tCF.setProperty("imqBrokerHostName", mHost);
67: return (tCF);
68: } catch (javax.jms.JMSException jEx) {
69: throw new ConnectionException(jEx);
70: }
71:
72: }
73:
74: /**
75: * Return a JMS Queue.
76: * @return Queue.
77: */
78: public Queue getQueue(String name) throws ConnectionException {
79: try {
80: return (new com.sun.messaging.Queue(name));
81: } catch (javax.jms.JMSException jEx) {
82: throw new ConnectionException(jEx);
83: }
84: }
85:
86: /**
87: * Return a JMS Topic.
88: * @return Topic.
89: */
90: public Topic getTopic(String name) throws ConnectionException {
91: try {
92: return (new com.sun.messaging.Topic(name));
93: } catch (javax.jms.JMSException jEx) {
94: throw new ConnectionException(jEx);
95: }
96: }
97: }
|