KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > jndi > AbstractJMSProviderAdapter


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.jms.jndi;
23
24 import java.io.Serializable JavaDoc;
25 import java.util.Properties JavaDoc;
26
27 /**
28  * An abstract implementaion of {@link JMSProviderAdapter}. Sub-classes must
29  * provide connection names via instance initialzation and provide an
30  * implementaion of {@link #getInitialContext}.
31  *
32  * 6/22/01 - hchirino - The queue/topic jndi references are now configed via JMX
33  *
34  * @version <pre>$Revision: 38361 $</pre>
35  * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a>
36  * @author <a HREF="mailto:cojonudo14@hotmail.com">Hiram Chirino</a>
37  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
38  */

39 public abstract class AbstractJMSProviderAdapter implements JMSProviderAdapter, Serializable JavaDoc
40 {
41    private static final long serialVersionUID = 3573606612665654983L;
42
43    /** The name of the provider. */
44    protected String JavaDoc name;
45
46    /** The properties. */
47    protected Properties JavaDoc properties;
48
49    /** The factory name to use. */
50    protected String JavaDoc factoryRef;
51
52    /** The queue factory name to use. */
53    protected String JavaDoc queueFactoryRef;
54
55    /** The topic factory name to use. */
56    protected String JavaDoc topicFactoryRef;
57
58    public void setName(final String JavaDoc name)
59    {
60       this.name = name;
61    }
62
63    public final String JavaDoc getName()
64    {
65       return name;
66    }
67
68    public void setProperties(final Properties JavaDoc properties)
69    {
70       this.properties = properties;
71    }
72
73    public final Properties JavaDoc getProperties()
74    {
75       return properties;
76    }
77
78    public String JavaDoc getFactoryRef()
79    {
80       if (factoryRef == null)
81          throw new IllegalStateException JavaDoc("Combined ConnectionFactory 'FactoryRef' not configured.");
82       return factoryRef;
83    }
84
85    public String JavaDoc getQueueFactoryRef()
86    {
87       if (queueFactoryRef == null)
88          throw new IllegalStateException JavaDoc("Queue ConnectionFactory 'QueueFactoryRef' not configured.");
89       return queueFactoryRef;
90    }
91
92    public String JavaDoc getTopicFactoryRef()
93    {
94       if (topicFactoryRef == null)
95          throw new IllegalStateException JavaDoc("Topic ConnectionFactory 'TopicFactoryRef' not configured.");
96       return topicFactoryRef;
97    }
98
99    public void setFactoryRef(String JavaDoc newFactoryRef)
100    {
101       factoryRef = newFactoryRef;
102    }
103
104    public void setQueueFactoryRef(String JavaDoc newQueueFactoryRef)
105    {
106       queueFactoryRef = newQueueFactoryRef;
107    }
108
109    public void setTopicFactoryRef(String JavaDoc newTopicFactoryRef)
110    {
111       topicFactoryRef = newTopicFactoryRef;
112    }
113 }
Popular Tags