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