001: /*
002:
003: Derby - Class org.apache.derby.iapi.sql.conn.LanguageConnectionFactory
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.sql.conn;
023:
024: import org.apache.derby.iapi.error.StandardException;
025: import org.apache.derby.iapi.db.Database;
026:
027: import org.apache.derby.iapi.store.access.AccessFactory;
028: import org.apache.derby.iapi.services.property.PropertyFactory;
029:
030: import org.apache.derby.iapi.sql.compile.OptimizerFactory;
031: import org.apache.derby.iapi.sql.compile.NodeFactory;
032: import org.apache.derby.iapi.sql.compile.CompilerContext;
033:
034: import org.apache.derby.iapi.types.DataValueFactory;
035: import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
036: import org.apache.derby.iapi.sql.execute.ExecutionFactory;
037: import org.apache.derby.iapi.sql.Activation;
038: import org.apache.derby.iapi.sql.Statement;
039: import org.apache.derby.iapi.sql.compile.Parser;
040:
041: import org.apache.derby.iapi.services.uuid.UUIDFactory;
042: import org.apache.derby.iapi.services.compiler.JavaFactory;
043: import org.apache.derby.iapi.services.loader.ClassFactory;
044: import org.apache.derby.iapi.services.context.ContextManager;
045: import org.apache.derby.iapi.services.cache.CacheManager;
046:
047: import org.apache.derby.iapi.sql.LanguageFactory;
048: import org.apache.derby.iapi.store.access.TransactionController;
049: import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
050:
051: import java.io.InputStream;
052:
053: import java.util.Locale;
054:
055: /**
056: * Factory interface for items specific to a connection in the language system.
057: * This is expected to be used internally, and so is not in Language.Interface.
058: * <p>
059: * This Factory provides pointers to other language factories; the
060: * LanguageConnectionContext holds more dynamic information, such as
061: * prepared statements and whether a commit has occurred or not.
062: * <p>
063: * This Factory is for internal items used throughout language during a
064: * connection. Things that users need for the Database API are in
065: * LanguageFactory in Language.Interface.
066: * <p>
067: * This factory returns (and thus starts) all the other per-database
068: * language factories. So there might someday be properties as to which
069: * ones to start (attributes, say, like level of optimization).
070: * If the request is relative to a specific connection, the connection
071: * is passed in. Otherwise, they are assumed to be database-wide services.
072: *
073: * @see org.apache.derby.iapi.sql.LanguageFactory
074: *
075: * @author ames
076: */
077: public interface LanguageConnectionFactory {
078: /**
079: Used to locate this factory by the Monitor basic service.
080: There needs to be a language factory per database.
081: */
082: String MODULE = "org.apache.derby.iapi.sql.conn.LanguageConnectionFactory";
083:
084: /**
085: Get a Statement
086: @param compilationSchema schema
087: @param statementText the text for the statement
088: @param forReadOnly true if concurrency mode is CONCUR_READ_ONLY
089: @return The Statement
090: */
091: Statement getStatement(SchemaDescriptor compilationSchema,
092: String statementText, boolean forReadOnly);
093:
094: /**
095: Get a new LanguageConnectionContext. this holds things
096: we want to remember about activity in the language system,
097: where this factory holds things that are pretty stable,
098: like other factories.
099: <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 newLanguageConnectionContext(
107: ContextManager cm, TransactionController tc,
108: LanguageFactory lf, Database db, String userName,
109: String drdaID, String dbname)
110:
111: throws StandardException;
112:
113: /**
114: Get the UUIDFactory to use with this language connection
115: */
116: UUIDFactory getUUIDFactory();
117:
118: /**
119: Get the ClassFactory to use with this language connection
120: */
121: ClassFactory getClassFactory();
122:
123: /**
124: Get the JavaFactory to use with this language connection
125: */
126: JavaFactory getJavaFactory();
127:
128: /**
129: Get the NodeFactory to use with this language connection
130: */
131: NodeFactory getNodeFactory();
132:
133: /**
134: Get the ExecutionFactory to use with this language connection
135: */
136: ExecutionFactory getExecutionFactory();
137:
138: /**
139: Get the PropertyFactory to use with this language connection
140: */
141: PropertyFactory getPropertyFactory();
142:
143: /**
144: Get the AccessFactory to use with this language connection
145: */
146: AccessFactory getAccessFactory();
147:
148: /**
149: Get the OptimizerFactory to use with this language connection
150: */
151: OptimizerFactory getOptimizerFactory();
152:
153: /**
154: Get the TypeCompilerFactory to use with this language connection
155: */
156: TypeCompilerFactory getTypeCompilerFactory();
157:
158: /**
159: Get the DataValueFactory to use with this language connection
160: This is expected to get stuffed into the language connection
161: context and accessed from there.
162:
163: */
164: DataValueFactory getDataValueFactory();
165:
166: public CacheManager getStatementCache();
167:
168: public Parser newParser(CompilerContext cc);
169: }
|