001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.jms.jndi;
023:
024: import java.io.Serializable;
025: import java.util.Properties;
026:
027: /**
028: * An abstract implementaion of {@link JMSProviderAdapter}. Sub-classes must
029: * provide connection names via instance initialzation and provide an
030: * implementaion of {@link #getInitialContext}.
031: *
032: * 6/22/01 - hchirino - The queue/topic jndi references are now configed via JMX
033: *
034: * @version <pre>$Revision: 57209 $</pre>
035: * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
036: * @author <a href="mailto:cojonudo14@hotmail.com">Hiram Chirino</a>
037: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
038: */
039: public abstract class AbstractJMSProviderAdapter implements
040: JMSProviderAdapter, Serializable {
041: private static final long serialVersionUID = 3573606612665654983L;
042:
043: /** The name of the provider. */
044: protected String name;
045:
046: /** The properties. */
047: protected Properties properties;
048:
049: /** The factory name to use. */
050: protected String factoryRef;
051:
052: /** The queue factory name to use. */
053: protected String queueFactoryRef;
054:
055: /** The topic factory name to use. */
056: protected String topicFactoryRef;
057:
058: public void setName(final String name) {
059: this .name = name;
060: }
061:
062: public final String getName() {
063: return name;
064: }
065:
066: public void setProperties(final Properties properties) {
067: this .properties = properties;
068: }
069:
070: public final Properties getProperties() {
071: return properties;
072: }
073:
074: public String getFactoryRef() {
075: if (factoryRef == null)
076: throw new IllegalStateException(
077: "Combined ConnectionFactory 'FactoryRef' not configured.");
078: return factoryRef;
079: }
080:
081: public String getQueueFactoryRef() {
082: if (queueFactoryRef == null)
083: throw new IllegalStateException(
084: "Queue ConnectionFactory 'QueueFactoryRef' not configured.");
085: return queueFactoryRef;
086: }
087:
088: public String getTopicFactoryRef() {
089: if (topicFactoryRef == null)
090: throw new IllegalStateException(
091: "Topic ConnectionFactory 'TopicFactoryRef' not configured.");
092: return topicFactoryRef;
093: }
094:
095: public void setFactoryRef(String newFactoryRef) {
096: factoryRef = newFactoryRef;
097: }
098:
099: public void setQueueFactoryRef(String newQueueFactoryRef) {
100: queueFactoryRef = newQueueFactoryRef;
101: }
102:
103: public void setTopicFactoryRef(String newTopicFactoryRef) {
104: topicFactoryRef = newTopicFactoryRef;
105: }
106: }
|