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