KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > execute > ExecutionContext


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.execute.ExecutionContext
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. 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  */

21
22 package org.apache.derby.iapi.sql.execute;
23
24 import org.apache.derby.iapi.services.context.Context;
25
26 import org.apache.derby.iapi.error.StandardException;
27
28 import org.apache.derby.iapi.sql.ResultSet;
29
30 /**
31  * ExecutionContext stores the factories that are to be used by
32  * the current connection. It also provides execution services
33  * for statement atomicity.
34  *
35  * @author ames
36  */

37 public interface ExecutionContext extends Context {
38
39     /**
40      * this is the ID we expect execution contexts
41      * to be stored into a context manager under.
42      */

43     String JavaDoc CONTEXT_ID = "ExecutionContext";
44     
45     
46     /* Constants for scan isolation levels. */
47     public static final int UNSPECIFIED_ISOLATION_LEVEL = 0;
48     public static final int READ_UNCOMMITTED_ISOLATION_LEVEL = 1;
49     public static final int READ_COMMITTED_ISOLATION_LEVEL = 2;
50     public static final int REPEATABLE_READ_ISOLATION_LEVEL = 3;
51     public static final int SERIALIZABLE_ISOLATION_LEVEL = 4;
52
53     public static final int[] CS_TO_JDBC_ISOLATION_LEVEL_MAP = {
54         java.sql.Connection.TRANSACTION_NONE, // UNSPECIFIED_ISOLATION_LEVEL
55
java.sql.Connection.TRANSACTION_READ_UNCOMMITTED, // READ_UNCOMMITTED_ISOLATION_LEVEL
56
java.sql.Connection.TRANSACTION_READ_COMMITTED, // READ_COMMITTED_ISOLATION_LEVEL
57
java.sql.Connection.TRANSACTION_REPEATABLE_READ, // REPEATABLE_READ_ISOLATION_LEVEL
58
java.sql.Connection.TRANSACTION_SERIALIZABLE // SERIALIZABLE_ISOLATION_LEVEL
59
};
60
61     public static final String JavaDoc[][] CS_TO_SQL_ISOLATION_MAP = {
62         { " "}, // UNSPECIFIED_ISOLATION_LEVEL
63
{ "UR", "DIRTY READ", "READ UNCOMMITTED"},
64         { "CS", "CURSOR STABILITY", "READ COMMITTED"},
65         { "RS"}, // read stability
66
{ "RR", "REPEATABLE READ", "SERIALIZABLE"}
67     };
68
69     /**
70      * Get the ResultSetFactory from this ExecutionContext.
71      *
72      * @return The result set factory associated with this
73      * ExecutionContext
74      */

75     ResultSetFactory getResultSetFactory();
76
77     /**
78      * Get the ResultSetStatisticsFactory from this ExecutionContext.
79      *
80      * @return The result set statistics factory associated with this
81      * ExecutionContext
82      *
83      * @exception StandardException Thrown on error
84      */

85     ResultSetStatisticsFactory getResultSetStatisticsFactory()
86                                 throws StandardException;
87
88     /**
89      * Get the ExecutionFactory from this ExecutionContext.
90      *
91      * @return The Execution factory associated with this
92      * ExecutionContext
93      */

94     ExecutionFactory getExecutionFactory();
95
96     /**
97      * Mark the beginning of a statement (INSERT, UPDATE, DELETE)
98      *
99      * @param sourceRS Source ResultSet for the statement.
100      * @exception StandardException Thrown on error
101      */

102     void beginStatement(ResultSet sourceRS) throws StandardException;
103
104     /**
105      * The end of a statement (INSERT, UPDATE, DELETE)
106      * @exception StandardException Thrown on error
107      */

108     void endStatement() throws StandardException;
109
110     /**
111       * Sifts the array of foreign key constraints for the ones
112       * which apply in the current context. In certain contexts
113       * (e.g., when applying the COPY file or when tearing-off
114       * a new table during REFRESH), we don't want to not bother
115       * enforcing some foreign keys.
116       *
117       * @param fullList the full list of foreign keys that
118       * apply for the current statement
119       *
120       * @return a pruned back list, which we will actually bother
121       * enforcing.
122       *
123       * @exception StandardException Thrown on error
124       */

125     public Object JavaDoc[] siftForeignKeys( Object JavaDoc[] fullList ) throws StandardException;
126
127     /**
128      * Sifts the triggers for the ones which apply in the current context.
129      * In certain contexts (e.g., when applying the COPY file or
130      * when tearing-off a new table during REFRESH), we don't want to
131      * not bother firing triggers.
132      *
133      * @param triggerInfo the original trigger info
134      *
135      * @return a pruned back triggerInfo, which we will actually bother
136      * enforcing.
137      *
138      * @exception StandardException Thrown on error
139      */

140     public Object JavaDoc siftTriggers(Object JavaDoc triggerInfo) throws StandardException;
141 }
142
Popular Tags