/projects/jboss-5.1.0/server/src/main/org/jboss/jms/jndi/AbstractJMSProviderAdapter.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 113 lines · 58 code · 17 blank · 38 comment · 6 complexity · 4460b1780229379f9189551eb7d40b8f MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a 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. import java.io.Serializable;
  24. import java.util.Properties;
  25. /**
  26. * An abstract implementaion of {@link JMSProviderAdapter}. Sub-classes must
  27. * provide connection names via instance initialzation and provide an
  28. * implementaion of {@link #getInitialContext}.
  29. *
  30. * 6/22/01 - hchirino - The queue/topic jndi references are now configed via JMX
  31. *
  32. * @version <pre>$Revision: 81030 $</pre>
  33. * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
  34. * @author <a href="mailto:cojonudo14@hotmail.com">Hiram Chirino</a>
  35. * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
  36. */
  37. public abstract class AbstractJMSProviderAdapter implements JMSProviderAdapter, Serializable
  38. {
  39. private static final long serialVersionUID = 3573606612665654983L;
  40. /** The name of the provider. */
  41. protected String name;
  42. /** The properties. */
  43. protected Properties properties;
  44. /** The factory name to use. */
  45. protected String factoryRef;
  46. /** The queue factory name to use. */
  47. protected String queueFactoryRef;
  48. /** The topic factory name to use. */
  49. protected String topicFactoryRef;
  50. public void setName(final String name)
  51. {
  52. this.name = name;
  53. }
  54. public final String getName()
  55. {
  56. return name;
  57. }
  58. public void setProperties(final Properties properties)
  59. {
  60. this.properties = properties;
  61. }
  62. public final Properties getProperties()
  63. {
  64. return properties;
  65. }
  66. public String getFactoryRef()
  67. {
  68. if (factoryRef == null)
  69. throw new IllegalStateException("Combined ConnectionFactory 'FactoryRef' not configured.");
  70. return factoryRef;
  71. }
  72. public String getQueueFactoryRef()
  73. {
  74. if (queueFactoryRef == null)
  75. throw new IllegalStateException("Queue ConnectionFactory 'QueueFactoryRef' not configured.");
  76. return queueFactoryRef;
  77. }
  78. public String getTopicFactoryRef()
  79. {
  80. if (topicFactoryRef == null)
  81. throw new IllegalStateException("Topic ConnectionFactory 'TopicFactoryRef' not configured.");
  82. return topicFactoryRef;
  83. }
  84. public void setFactoryRef(String newFactoryRef)
  85. {
  86. factoryRef = newFactoryRef;
  87. }
  88. public void setQueueFactoryRef(String newQueueFactoryRef)
  89. {
  90. queueFactoryRef = newQueueFactoryRef;
  91. }
  92. public void setTopicFactoryRef(String newTopicFactoryRef)
  93. {
  94. topicFactoryRef = newTopicFactoryRef;
  95. }
  96. }