View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 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  package org.apache.geronimo.connector.outbound;
19  
20  /**
21   * ConnectionInfo.java
22   *
23   *
24   * Created: Thu Sep 25 14:29:07 2003
25   *
26   * @version 1.0
27   */
28  public class ConnectionInfo {
29  
30      private ManagedConnectionInfo mci;
31      private Object connection;
32      private boolean unshareable;
33      private boolean applicationManagedSecurity;
34      private Exception trace;
35  
36      public ConnectionInfo() {
37      } // ConnectionInfo constructor
38  
39      public ConnectionInfo(ManagedConnectionInfo mci) {
40          this.mci = mci;
41      }
42  
43      /**
44       * Get the Mci value.
45       * @return the Mci value.
46       */
47      public ManagedConnectionInfo getManagedConnectionInfo() {
48          return mci;
49      }
50  
51      /**
52       * Set the Mci value.
53       * @param mci The new Mci value.
54       */
55      public void setManagedConnectionInfo(ManagedConnectionInfo mci) {
56          this.mci = mci;
57      }
58  
59      /**
60       * Get the Connection value.
61       * @return the Connection value.
62       */
63      public Object getConnectionHandle() {
64          return connection;
65      }
66  
67      /**
68       * Set the Connection value.
69       * @param connection The new Connection value.
70       */
71      public void setConnectionHandle(Object connection) {
72          assert this.connection == null;
73          this.connection = connection;
74      }
75  
76      public boolean isUnshareable() {
77          return unshareable;
78      }
79  
80      public void setUnshareable(boolean unshareable) {
81          this.unshareable = unshareable;
82      }
83  
84      public boolean isApplicationManagedSecurity() {
85          return applicationManagedSecurity;
86      }
87  
88      public void setApplicationManagedSecurity(boolean applicationManagedSecurity) {
89          this.applicationManagedSecurity = applicationManagedSecurity;
90      }
91  
92      public boolean equals(Object obj) {
93          if (obj == this) {
94              return true;
95          }
96          if (obj instanceof ConnectionInfo) {
97              ConnectionInfo other = (ConnectionInfo) obj;
98              return (connection == other.connection)
99                      && (mci == other.mci);
100         }
101         return false;
102     }
103 
104     public int hashCode() {
105         return ((connection != null) ? connection.hashCode() : 7) ^
106                 ((mci != null) ? mci.hashCode() : 7);
107     }
108 
109     public void setTrace() {
110         this.trace = new Exception("Stack Trace");
111     }
112 
113     public Exception getTrace() {
114         return trace;
115     }
116 
117 
118 
119 } // ConnectionInfo