PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/testsuite/integration/smoke/src/test/java/org/jboss/as/test/smoke/deployment/rar/MultipleResourceAdapter.java

#
Java | 174 lines | 69 code | 18 blank | 87 comment | 11 complexity | 500b0beda4994b3b1377669f02985927 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2011, 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.as.test.smoke.deployment.rar;
  23. import java.io.Serializable;
  24. import java.util.logging.Logger;
  25. import javax.resource.ResourceException;
  26. import javax.resource.spi.ActivationSpec;
  27. import javax.resource.spi.BootstrapContext;
  28. import javax.resource.spi.ResourceAdapter;
  29. import javax.resource.spi.ResourceAdapterInternalException;
  30. import javax.resource.spi.endpoint.MessageEndpointFactory;
  31. import javax.transaction.xa.XAResource;
  32. /**
  33. * MultipleResourceAdapter
  34. *
  35. * @version $Revision: $
  36. */
  37. public class MultipleResourceAdapter implements ResourceAdapter, Serializable {
  38. /**
  39. * The logger
  40. */
  41. private static Logger log = Logger.getLogger("MultipleResourceAdapter");
  42. /**
  43. * Name
  44. */
  45. private String name;
  46. /**
  47. * Default constructor
  48. */
  49. public MultipleResourceAdapter() {
  50. }
  51. /**
  52. * Set name
  53. *
  54. * @param name The value
  55. */
  56. public void setName(String name) {
  57. this.name = name;
  58. }
  59. /**
  60. * Get name
  61. *
  62. * @return The value
  63. */
  64. public String getName() {
  65. return name;
  66. }
  67. /**
  68. * This is called during the activation of a message endpoint.
  69. *
  70. * @param endpointFactory A message endpoint factory instance.
  71. * @param spec An activation spec JavaBean instance.
  72. * @throws ResourceException generic exception
  73. */
  74. public void endpointActivation(MessageEndpointFactory endpointFactory,
  75. ActivationSpec spec) throws ResourceException {
  76. log.finest("endpointActivation()");
  77. }
  78. /**
  79. * This is called when a message endpoint is deactivated.
  80. *
  81. * @param endpointFactory A message endpoint factory instance.
  82. * @param spec An activation spec JavaBean instance.
  83. */
  84. public void endpointDeactivation(MessageEndpointFactory endpointFactory,
  85. ActivationSpec spec) {
  86. log.finest("endpointDeactivation()");
  87. }
  88. /**
  89. * This is called when a resource adapter instance is bootstrapped.
  90. *
  91. * @param ctx A bootstrap context containing references
  92. * @throws ResourceAdapterInternalException
  93. * indicates bootstrap failure.
  94. */
  95. public void start(BootstrapContext ctx)
  96. throws ResourceAdapterInternalException {
  97. log.finest("start()");
  98. }
  99. /**
  100. * This is called when a resource adapter instance is undeployed or
  101. * during application server shutdown.
  102. */
  103. public void stop() {
  104. log.finest("stop()");
  105. }
  106. /**
  107. * This method is called by the application server during crash recovery.
  108. *
  109. * @param specs An array of ActivationSpec JavaBeans
  110. * @return An array of XAResource objects
  111. * @throws ResourceException generic exception
  112. */
  113. public XAResource[] getXAResources(ActivationSpec[] specs)
  114. throws ResourceException {
  115. log.finest("getXAResources()");
  116. return null;
  117. }
  118. /**
  119. * Returns a hash code value for the object.
  120. *
  121. * @return A hash code value for this object.
  122. */
  123. @Override
  124. public int hashCode() {
  125. int result = 17;
  126. if (name != null)
  127. result += 31 * result + 7 * name.hashCode();
  128. else
  129. result += 31 * result + 7;
  130. return result;
  131. }
  132. /**
  133. * Indicates whether some other object is equal to this one.
  134. *
  135. * @param other The reference object with which to compare.
  136. * @return true if this object is the same as the obj argument, false otherwise.
  137. */
  138. @Override
  139. public boolean equals(Object other) {
  140. if (other == null)
  141. return false;
  142. if (other == this)
  143. return true;
  144. if (!(other instanceof MultipleResourceAdapter))
  145. return false;
  146. MultipleResourceAdapter obj = (MultipleResourceAdapter) other;
  147. boolean result = true;
  148. if (result) {
  149. if (name == null)
  150. result = obj.getName() == null;
  151. else
  152. result = name.equals(obj.getName());
  153. }
  154. return result;
  155. }
  156. }