KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > virtualdatabase > ConnectionContext


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2006 Continuent, Inc.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.virtualdatabase;
23
24 import java.io.Serializable JavaDoc;
25
26 /**
27  * This class defines a ConnectionContext to carry information about the
28  * connection to gather metadata.
29  *
30  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
31  * @version 1.0
32  */

33 public class ConnectionContext implements Serializable JavaDoc
34 {
35   private static final long serialVersionUID = 4211807376311527783L;
36
37   private String JavaDoc login;
38   private boolean isPersistentConnection;
39   private long persistentConnectionId;
40   private long currentTid;
41   private boolean isStartedTransaction;
42
43   /**
44    * Creates a new <code>ConnectionContext</code> object
45    *
46    * @param login login of the connection
47    * @param isTransaction true if the connection is not in autocommit
48    * @param transactionId transaction id (if isTransaction is true)
49    * @param isPersistent true if the connection is persistent
50    * @param persistentId persistent connection id if the connection is
51    * persistent
52    */

53   public ConnectionContext(String JavaDoc login, boolean isTransaction,
54       long transactionId, boolean isPersistent, long persistentId)
55   {
56     this.login = login;
57     isStartedTransaction = isTransaction;
58     currentTid = transactionId;
59     isPersistentConnection = isPersistent;
60     persistentConnectionId = persistentId;
61   }
62
63   /**
64    * Returns the transaction id (only makes sense if isStartedTransaction is
65    * true).
66    *
67    * @return Returns the transaction id.
68    */

69   public final long getTransactionId()
70   {
71     return currentTid;
72   }
73
74   /**
75    * Returns the login value.
76    *
77    * @return Returns the login.
78    */

79   public final String JavaDoc getLogin()
80   {
81     return login;
82   }
83
84   /**
85    * Returns the persistentConnectionId value.
86    *
87    * @return Returns the persistentConnectionId.
88    */

89   public final long getPersistentConnectionId()
90   {
91     return persistentConnectionId;
92   }
93
94   /**
95    * Returns the isPersistentConnection value.
96    *
97    * @return Returns the isPersistentConnection.
98    */

99   public final boolean isPersistentConnection()
100   {
101     return isPersistentConnection;
102   }
103
104   /**
105    * Returns the isStartedTransaction value.
106    *
107    * @return Returns the isStartedTransaction.
108    */

109   public final boolean isStartedTransaction()
110   {
111     return isStartedTransaction;
112   }
113
114   /**
115    * Sets the isStartedTransaction value.
116    *
117    * @param isStartedTransaction The isStartedTransaction to set.
118    */

119   public final void setStartedTransaction(boolean isStartedTransaction)
120   {
121     this.isStartedTransaction = isStartedTransaction;
122   }
123
124 }
125
Popular Tags