KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > driver > Savepoint


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Jean-Bernard van Zuylen.
21  * Contributor(s): ______________________.
22  */

23
24 package org.continuent.sequoia.driver;
25
26 import java.sql.SQLException JavaDoc;
27
28 /**
29  * This class defines a Savepoint
30  *
31  * @author <a HREF="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
32  * </a>
33  * @version 1.0
34  */

35 public class Savepoint implements java.sql.Savepoint JavaDoc
36 {
37   private int savepointId;
38
39   private String JavaDoc savepointName;
40
41   /**
42    * Creates a new un-named <code>Savepoint</code> object
43    *
44    * @param savepointId the generated ID for this savepoint
45    */

46   public Savepoint(int savepointId)
47   {
48     this.savepointId = savepointId;
49   }
50
51   /**
52    * Creates a new named <code>Savepoint</code> object
53    *
54    * @param savepointName the name of the savepoint
55    */

56   public Savepoint(String JavaDoc savepointName)
57   {
58     this.savepointName = savepointName;
59   }
60
61   /**
62    * @see java.sql.Savepoint#getSavepointId()
63    */

64   public int getSavepointId() throws SQLException JavaDoc
65   {
66     if (this.savepointName != null)
67       throw new SQLException JavaDoc("This is a named savepoint");
68
69     return this.savepointId;
70   }
71
72   /**
73    * @see java.sql.Savepoint#getSavepointName()
74    */

75   public String JavaDoc getSavepointName() throws SQLException JavaDoc
76   {
77     if (this.savepointName == null)
78       throw new SQLException JavaDoc("This is an unnamed savepoint");
79
80     return this.savepointName;
81   }
82 }
83
Popular Tags