KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > catalog > DataDictionaryContextImpl


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.catalog.DataDictionaryContextImpl
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.impl.sql.catalog;
23
24 import org.apache.derby.iapi.services.context.ContextImpl;
25 import org.apache.derby.iapi.services.context.ContextManager;
26 import org.apache.derby.iapi.error.StandardException;
27 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
28 import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;
29 import org.apache.derby.iapi.error.ExceptionSeverity;
30 /*
31  * DataDictionaryContextImpl
32  *
33  * This class supports both nested and outer data dictionaries. The
34  * outer data dictionary defines the name space for a database.
35  * A nested data dictionary defines a name space for a publication
36  * (or schema in the future).
37  *
38  * During error processing, a nested data dictionary context is popped
39  * for statement errors or higher. The outer data dictionary context
40  * is not popped by cleanupOnError.
41  */

42 class DataDictionaryContextImpl
43     extends ContextImpl
44     implements DataDictionaryContext
45 {
46     //
47
// DataDictionaryContext interface
48
//
49
// we might want these to refuse to return
50
// anything if they are in-use -- would require
51
// the interface provide a 'done' call, and
52
// we would mark them in-use whenever a get happened.
53
public DataDictionary getDataDictionary()
54     {
55         return dataDictionary;
56     }
57
58     public void cleanupOnError(Throwable JavaDoc error)
59     {
60         if (error instanceof StandardException)
61         {
62             StandardException se = (StandardException)error;
63             if (se.getSeverity() < ExceptionSeverity.SESSION_SEVERITY)
64                 return;
65         }
66         popMe();
67     }
68
69     //
70
// class interface
71
//
72
// this constructor is called with the data dictionary
73
// to be saved when the context
74
// is created
75

76     DataDictionaryContextImpl(ContextManager cm, DataDictionary dataDictionary)
77     {
78         super(cm, DataDictionaryContext.CONTEXT_ID);
79
80         this.dataDictionary = dataDictionary;
81     }
82
83     final DataDictionary dataDictionary;
84 }
85
Popular Tags