01: package org.apache.ojb.otm.connector;
02:
03: /* Copyright 2003-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import org.apache.ojb.broker.PBKey;
19: import org.apache.ojb.broker.PersistenceBrokerFactory;
20:
21: import javax.resource.spi.ConnectionRequestInfo;
22:
23: /**
24: *
25: * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird<a>
26: */
27:
28: public class OTMConnectionRequestInfo implements ConnectionRequestInfo {
29: private PBKey m_pbKey;
30:
31: public OTMConnectionRequestInfo(PBKey pbkey) {
32: Util.log("In OTMConnectionRequestInfo");
33: m_pbKey = pbkey;
34: }
35:
36: public PBKey getPbKey() {
37: if (m_pbKey == null)
38: return PersistenceBrokerFactory.getDefaultKey();
39: else
40: return m_pbKey;
41: }
42:
43: public boolean equals(Object o) {
44: if (this == o)
45: return true;
46: if (!(o instanceof OTMConnectionRequestInfo))
47: return false;
48:
49: final OTMConnectionRequestInfo otmConnectionRequestInfo = (OTMConnectionRequestInfo) o;
50:
51: if (m_pbKey != null ? !m_pbKey
52: .equals(otmConnectionRequestInfo.m_pbKey)
53: : otmConnectionRequestInfo.m_pbKey != null)
54: return false;
55:
56: return true;
57: }
58:
59: public int hashCode() {
60: return (m_pbKey != null ? m_pbKey.hashCode() : 0);
61: }
62: }
|