KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > otm > connector > OTMConnectionRequestInfo


1 package org.apache.ojb.otm.connector;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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 JavaDoc;
22
23 /**
24  *
25  * @author <a HREF="mailto:mattbaird@yahoo.com">Matthew Baird<a>
26  */

27
28 public class OTMConnectionRequestInfo
29         implements ConnectionRequestInfo JavaDoc
30 {
31     private PBKey m_pbKey;
32
33     public OTMConnectionRequestInfo(PBKey pbkey)
34     {
35         Util.log("In OTMConnectionRequestInfo");
36         m_pbKey = pbkey;
37     }
38
39     public PBKey getPbKey()
40     {
41         if (m_pbKey == null)
42             return PersistenceBrokerFactory.getDefaultKey();
43         else
44             return m_pbKey;
45     }
46
47     public boolean equals(Object JavaDoc o)
48     {
49         if (this == o) return true;
50         if (!(o instanceof OTMConnectionRequestInfo)) return false;
51
52         final OTMConnectionRequestInfo otmConnectionRequestInfo = (OTMConnectionRequestInfo) o;
53
54         if (m_pbKey != null ? !m_pbKey.equals(otmConnectionRequestInfo.m_pbKey) : otmConnectionRequestInfo.m_pbKey != null) return false;
55
56         return true;
57     }
58
59     public int hashCode()
60     {
61         return (m_pbKey != null ? m_pbKey.hashCode() : 0);
62     }
63 }
64
Popular Tags