Source code: org/apache/derby/iapi/sql/conn/LanguageConnectionFactory.java
1 /*
2
3 Derby - Class org.apache.derby.iapi.sql.conn.LanguageConnectionFactory
4
5 Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19 */
20
21 package org.apache.derby.iapi.sql.conn;
22
23 import org.apache.derby.iapi.error.StandardException;
24 import org.apache.derby.iapi.db.Database;
25
26 import org.apache.derby.iapi.store.access.AccessFactory;
27 import org.apache.derby.iapi.services.property.PropertyFactory;
28
29 import org.apache.derby.iapi.sql.compile.OptimizerFactory;
30 import org.apache.derby.iapi.sql.compile.NodeFactory;
31 import org.apache.derby.iapi.sql.compile.CompilerContext;
32
33 import org.apache.derby.iapi.types.DataValueFactory;
34 import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
35 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
36 import org.apache.derby.iapi.sql.Activation;
37 import org.apache.derby.iapi.sql.Statement;
38 import org.apache.derby.iapi.sql.compile.Parser;
39
40 import org.apache.derby.iapi.services.uuid.UUIDFactory;
41 import org.apache.derby.iapi.services.compiler.JavaFactory;
42 import org.apache.derby.iapi.services.loader.ClassFactory;
43 import org.apache.derby.iapi.services.context.ContextManager;
44 import org.apache.derby.iapi.services.cache.CacheManager;
45
46 import org.apache.derby.iapi.sql.LanguageFactory;
47 import org.apache.derby.iapi.store.access.TransactionController;
48 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
49
50 import java.io.InputStream;
51
52 import java.util.Locale;
53
54 /**
55 * Factory interface for items specific to a connection in the language system.
56 * This is expected to be used internally, and so is not in Language.Interface.
57 * <p>
58 * This Factory provides pointers to other language factories; the
59 * LanguageConnectionContext holds more dynamic information, such as
60 * prepared statements and whether a commit has occurred or not.
61 * <p>
62 * This Factory is for internal items used throughout language during a
63 * connection. Things that users need for the Database API are in
64 * LanguageFactory in Language.Interface.
65 * <p>
66 * This factory returns (and thus starts) all the other per-database
67 * language factories. So there might someday be properties as to which
68 * ones to start (attributes, say, like level of optimization).
69 * If the request is relative to a specific connection, the connection
70 * is passed in. Otherwise, they are assumed to be database-wide services.
71 *
72 * @see org.apache.derby.iapi.sql.LanguageFactory
73 *
74 * @author ames
75 */
76 public interface LanguageConnectionFactory {
77 /**
78 Used to locate this factory by the Monitor basic service.
79 There needs to be a language factory per database.
80 */
81 String MODULE = "org.apache.derby.iapi.sql.conn.LanguageConnectionFactory";
82
83 /**
84 Get a Statement.
85
86 @param statementText the text for the statement
87 @return The Statement
88 */
89 Statement getStatement(SchemaDescriptor compilationSchema, String statementText);
90
91 /**
92 Get a new LanguageConnectionContext. this holds things
93 we want to remember about activity in the language system,
94 where this factory holds things that are pretty stable,
95 like other factories.
96 <p>
97 The returned LanguageConnectionContext is intended for use
98 only by the connection that requested it.
99
100 @return a language connection context for the context stack.
101 @exception StandardException the usual
102 */
103 LanguageConnectionContext
104 newLanguageConnectionContext(ContextManager cm,
105 TransactionController tc,
106 LanguageFactory lf,
107 Database db,
108 String userName,
109 String drdaID,
110 String dbname)
111
112 throws StandardException;
113
114 /**
115 Get the UUIDFactory to use with this language connection
116 */
117 UUIDFactory getUUIDFactory();
118
119 /**
120 Get the ClassFactory to use with this language connection
121 */
122 ClassFactory getClassFactory();
123
124 /**
125 Get the JavaFactory to use with this language connection
126 */
127 JavaFactory getJavaFactory();
128
129 /**
130 Get the NodeFactory to use with this language connection
131 */
132 NodeFactory getNodeFactory();
133
134 /**
135 Get the ExecutionFactory to use with this language connection
136 */
137 ExecutionFactory getExecutionFactory();
138
139 /**
140 Get the PropertyFactory to use with this language connection
141 */
142 PropertyFactory getPropertyFactory();
143
144 /**
145 Get the AccessFactory to use with this language connection
146 */
147 AccessFactory getAccessFactory();
148
149 /**
150 Get the OptimizerFactory to use with this language connection
151 */
152 OptimizerFactory getOptimizerFactory();
153
154 /**
155 Get the TypeCompilerFactory to use with this language connection
156 */
157 TypeCompilerFactory getTypeCompilerFactory();
158
159 /**
160 Get the DataValueFactory to use with this language connection
161 This is expected to get stuffed into the language connection
162 context and accessed from there.
163
164 */
165 DataValueFactory getDataValueFactory();
166
167 public CacheManager getStatementCache();
168
169 public Parser newParser(CompilerContext cc);
170 }