Package org.apache.derby.impl.sql.conn
Class GenericLanguageConnectionFactory
- java.lang.Object
-
- org.apache.derby.impl.sql.conn.GenericLanguageConnectionFactory
-
- All Implemented Interfaces:
CacheableFactory,ModuleControl,ModuleSupportable,PropertySetCallback,LanguageConnectionFactory
public class GenericLanguageConnectionFactory extends java.lang.Object implements LanguageConnectionFactory, CacheableFactory, PropertySetCallback, ModuleControl, ModuleSupportable
LanguageConnectionFactory generates all of the items a language system needs that is specific to a particular connection. Alot of these are other factories.
-
-
Field Summary
Fields Modifier and Type Field Description private intcacheSizeprivate ClassFactoryclassFactoryprivate DataValueFactorydvfprivate ExecutionFactoryefprivate JavaFactoryjavaFactoryprivate intnextLCCInstanceNumberprivate OptimizerFactoryofprivate PropertyFactorypfprivate CacheManagersingleStatementCacheprivate TypeCompilerFactorytcfprivate UUIDFactoryuuidFactory-
Fields inherited from interface org.apache.derby.iapi.sql.conn.LanguageConnectionFactory
MODULE
-
-
Constructor Summary
Constructors Constructor Description GenericLanguageConnectionFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Serviceableapply(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)Apply a property change.voidboot(boolean create, java.util.Properties startParams)Start-up method for this instance of the language connection factory.private static java.lang.ObjectbootServiceModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.util.Properties properties)Privileged startup.booleancanSupport(java.util.Properties startParams)this implementation will not support caching of statements.private static java.lang.ObjectfindServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface)Privileged startup.private static java.lang.ObjectfindSystemModule(java.lang.String factoryInterface)Privileged lookup.ClassFactorygetClassFactory()Get the ClassFactory to use with this language connectionDataValueFactorygetDataValueFactory()Get the DataValueFactory to use with this language connectionExecutionFactorygetExecutionFactory()Get the ExecutionFactory to use with this language connectionJavaFactorygetJavaFactory()Get the JavaFactory to use with this language connection REMIND: this is only used by the compiler; should there be a compiler module control class to boot compiler-only stuff?(package private) static ModuleFactorygetMonitor()Privileged Monitor lookup.protected intgetNextLCCInstanceNumber()Get the instance # for the next LCC.OptimizerFactorygetOptimizerFactory()Get the OptimizerFactory to use with this language connectionPropertyFactorygetPropertyFactory()Get the PropertyFactory to use with this language connectionprivate static java.lang.ObjectgetServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface)Privileged module lookup.StatementgetStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean forReadOnly)Get a Statement for the connectionCacheManagergetStatementCache()returns the statement cache that this connection should use; currently there is a statement cache per database.TypeCompilerFactorygetTypeCompilerFactory()Get the TypeCompilerFactory to use with this language connectionUUIDFactorygetUUIDFactory()Get the UUIDFactory to use with this language connection REMIND: this is only used by the compiler; should there be a compiler module control class to boot compiler-only stuff?voidinit(boolean dbOnly, java.util.Dictionary p)Initialize the properties for this callback.java.io.Serializablemap(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)Map a proposed new value for a property to an official value.CacheablenewCacheable(CacheManager cm)LanguageConnectionContextnewLanguageConnectionContext(ContextManager cm, TransactionController tc, LanguageFactory lf, Database db, java.lang.String userName, java.lang.String drdaID, java.lang.String dbname)Get a LanguageConnectionContext. this holds things we want to remember about activity in the language system, where this factory holds things that are pretty stable, like other factories.ParsernewParser(CompilerContext cc)protected voidsetValidation()private static java.lang.ObjectstartSystemModule(java.lang.String factoryInterface)Privileged startup.private intstatementCacheSize(java.util.Properties startParams)voidstop()Stop this module.booleanvalidate(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)Validate a property change.
-
-
-
Field Detail
-
ef
private ExecutionFactory ef
-
of
private OptimizerFactory of
-
tcf
private TypeCompilerFactory tcf
-
dvf
private DataValueFactory dvf
-
uuidFactory
private UUIDFactory uuidFactory
-
javaFactory
private JavaFactory javaFactory
-
classFactory
private ClassFactory classFactory
-
pf
private PropertyFactory pf
-
nextLCCInstanceNumber
private int nextLCCInstanceNumber
-
cacheSize
private int cacheSize
-
singleStatementCache
private CacheManager singleStatementCache
-
-
Method Detail
-
getStatement
public Statement getStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean forReadOnly)
Get a Statement for the connection- Specified by:
getStatementin interfaceLanguageConnectionFactory- Parameters:
compilationSchema- schemastatementText- the text for the statementforReadOnly- if concurrency is CONCUR_READ_ONLY- Returns:
- The Statement
-
newLanguageConnectionContext
public LanguageConnectionContext newLanguageConnectionContext(ContextManager cm, TransactionController tc, LanguageFactory lf, Database db, java.lang.String userName, java.lang.String drdaID, java.lang.String dbname) throws StandardException
Get a LanguageConnectionContext. this holds things we want to remember about activity in the language system, where this factory holds things that are pretty stable, like other factories.The returned LanguageConnectionContext is intended for use only by the connection that requested it.
- Specified by:
newLanguageConnectionContextin interfaceLanguageConnectionFactory- Returns:
- a language connection context for the context stack.
- Throws:
StandardException- the usual -- for the subclass
-
newCacheable
public Cacheable newCacheable(CacheManager cm)
- Specified by:
newCacheablein interfaceCacheableFactory
-
getUUIDFactory
public UUIDFactory getUUIDFactory()
Get the UUIDFactory to use with this language connection REMIND: this is only used by the compiler; should there be a compiler module control class to boot compiler-only stuff?- Specified by:
getUUIDFactoryin interfaceLanguageConnectionFactory
-
getClassFactory
public ClassFactory getClassFactory()
Get the ClassFactory to use with this language connection- Specified by:
getClassFactoryin interfaceLanguageConnectionFactory
-
getJavaFactory
public JavaFactory getJavaFactory()
Get the JavaFactory to use with this language connection REMIND: this is only used by the compiler; should there be a compiler module control class to boot compiler-only stuff?- Specified by:
getJavaFactoryin interfaceLanguageConnectionFactory
-
getExecutionFactory
public ExecutionFactory getExecutionFactory()
Get the ExecutionFactory to use with this language connection- Specified by:
getExecutionFactoryin interfaceLanguageConnectionFactory
-
getPropertyFactory
public PropertyFactory getPropertyFactory()
Get the PropertyFactory to use with this language connection- Specified by:
getPropertyFactoryin interfaceLanguageConnectionFactory
-
getOptimizerFactory
public OptimizerFactory getOptimizerFactory()
Get the OptimizerFactory to use with this language connection- Specified by:
getOptimizerFactoryin interfaceLanguageConnectionFactory
-
getTypeCompilerFactory
public TypeCompilerFactory getTypeCompilerFactory()
Get the TypeCompilerFactory to use with this language connection- Specified by:
getTypeCompilerFactoryin interfaceLanguageConnectionFactory
-
getDataValueFactory
public DataValueFactory getDataValueFactory()
Get the DataValueFactory to use with this language connection- Specified by:
getDataValueFactoryin interfaceLanguageConnectionFactory
-
canSupport
public boolean canSupport(java.util.Properties startParams)
this implementation will not support caching of statements.- Specified by:
canSupportin interfaceModuleSupportable- Returns:
- true if this instance can be used, false otherwise.
-
statementCacheSize
private int statementCacheSize(java.util.Properties startParams)
-
boot
public void boot(boolean create, java.util.Properties startParams) throws StandardExceptionStart-up method for this instance of the language connection factory. Note these are expected to be booted relative to a Database.- Specified by:
bootin interfaceModuleControl- Parameters:
startParams- The start-up parameters (ignored in this case)- Throws:
StandardException- Thrown on failure to boot- See Also:
Monitor,ModuleFactory
-
getStatementCache
public CacheManager getStatementCache()
returns the statement cache that this connection should use; currently there is a statement cache per database.- Specified by:
getStatementCachein interfaceLanguageConnectionFactory
-
stop
public void stop()
Stop this module.- Specified by:
stopin interfaceModuleControl- See Also:
Monitor,ModuleFactory
-
init
public void init(boolean dbOnly, java.util.Dictionary p)Description copied from interface:PropertySetCallbackInitialize the properties for this callback. Called when addPropertySetNotification() is called with a non-null transaction controller. This allows code to set read its initial property values at boot time.Code within an init() method should use the 3 argument PropertyUtil method getPropertyFromSet() to obtain a property's value.
- Specified by:
initin interfacePropertySetCallback- Parameters:
dbOnly- true if only per-database properties are to be looked atp- the complete set of per-database properties.
-
validate
public boolean validate(java.lang.String key, java.io.Serializable value, java.util.Dictionary p) throws StandardExceptionDescription copied from interface:PropertySetCallbackValidate a property change.- Specified by:
validatein interfacePropertySetCallback- Parameters:
key- Property key for the property being setvalue- proposed new value for the property being set or null if the property is being dropped.p- Property set before the change. SettingProperty may read but must never change p.- Returns:
- true if this object was interested in this property, false otherwise.
- Throws:
StandardException- Thrown on error.- See Also:
PropertySetCallback.validate(java.lang.String, java.io.Serializable, java.util.Dictionary)
-
apply
public Serviceable apply(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)
Description copied from interface:PropertySetCallbackApply a property change. Will only be called after validate has been called and only if validate returned true. If this method is called then the new value is the value to be used, ie. the property is not set in the overriding JVM system set.- Specified by:
applyin interfacePropertySetCallback- Parameters:
key- Property key for the property being setvalue- proposed new value for the property being set or null if the property is being dropped.p- Property set before the change. SettingProperty may read but must never change p.- Returns:
- post commit work for the property change.
- See Also:
PropertySetCallback.apply(java.lang.String, java.io.Serializable, java.util.Dictionary)
-
map
public java.io.Serializable map(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)Description copied from interface:PropertySetCallbackMap a proposed new value for a property to an official value. Will only be called after apply() has been called.- Specified by:
mapin interfacePropertySetCallback- Parameters:
key- Property key for the property being setvalue- proposed new value for the property being set or null if the property is being dropped.p- Property set before the change. SettingProperty may read but must never change p.- Returns:
- new value for the change
- See Also:
PropertySetCallback.map(java.lang.String, java.io.Serializable, java.util.Dictionary)
-
setValidation
protected void setValidation() throws StandardException- Throws:
StandardException
-
newParser
public Parser newParser(CompilerContext cc)
- Specified by:
newParserin interfaceLanguageConnectionFactory
-
getNextLCCInstanceNumber
protected int getNextLCCInstanceNumber()
Get the instance # for the next LCC. (Useful for logStatementText=true output.- Returns:
- instance # of next LCC.
-
getMonitor
static ModuleFactory getMonitor()
Privileged Monitor lookup. Must be package private so that user code can't call this entry point.
-
startSystemModule
private static java.lang.Object startSystemModule(java.lang.String factoryInterface) throws StandardExceptionPrivileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
findSystemModule
private static java.lang.Object findSystemModule(java.lang.String factoryInterface) throws StandardExceptionPrivileged lookup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
bootServiceModule
private static java.lang.Object bootServiceModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.util.Properties properties) throws StandardExceptionPrivileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
findServiceModule
private static java.lang.Object findServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface) throws StandardExceptionPrivileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
getServiceModule
private static java.lang.Object getServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface)Privileged module lookup. Must be private so that user code can't call this entry point.
-
-