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 int
cacheSize
private ClassFactory
classFactory
private DataValueFactory
dvf
private ExecutionFactory
ef
private JavaFactory
javaFactory
private int
nextLCCInstanceNumber
private OptimizerFactory
of
private PropertyFactory
pf
private CacheManager
singleStatementCache
private TypeCompilerFactory
tcf
private UUIDFactory
uuidFactory
-
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 Serviceable
apply(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)
Apply a property change.void
boot(boolean create, java.util.Properties startParams)
Start-up method for this instance of the language connection factory.private static java.lang.Object
bootServiceModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.util.Properties properties)
Privileged startup.boolean
canSupport(java.util.Properties startParams)
this implementation will not support caching of statements.private static java.lang.Object
findServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface)
Privileged startup.private static java.lang.Object
findSystemModule(java.lang.String factoryInterface)
Privileged lookup.ClassFactory
getClassFactory()
Get the ClassFactory to use with this language connectionDataValueFactory
getDataValueFactory()
Get the DataValueFactory to use with this language connectionExecutionFactory
getExecutionFactory()
Get the ExecutionFactory to use with this language connectionJavaFactory
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?(package private) static ModuleFactory
getMonitor()
Privileged Monitor lookup.protected int
getNextLCCInstanceNumber()
Get the instance # for the next LCC.OptimizerFactory
getOptimizerFactory()
Get the OptimizerFactory to use with this language connectionPropertyFactory
getPropertyFactory()
Get the PropertyFactory to use with this language connectionprivate static java.lang.Object
getServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface)
Privileged module lookup.Statement
getStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean forReadOnly)
Get a Statement for the connectionCacheManager
getStatementCache()
returns the statement cache that this connection should use; currently there is a statement cache per database.TypeCompilerFactory
getTypeCompilerFactory()
Get the TypeCompilerFactory to use with this language connectionUUIDFactory
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?void
init(boolean dbOnly, java.util.Dictionary p)
Initialize the properties for this callback.java.io.Serializable
map(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)
Map a proposed new value for a property to an official value.Cacheable
newCacheable(CacheManager cm)
LanguageConnectionContext
newLanguageConnectionContext(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.Parser
newParser(CompilerContext cc)
protected void
setValidation()
private static java.lang.Object
startSystemModule(java.lang.String factoryInterface)
Privileged startup.private int
statementCacheSize(java.util.Properties startParams)
void
stop()
Stop this module.boolean
validate(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:
getStatement
in 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:
newLanguageConnectionContext
in 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:
newCacheable
in 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:
getUUIDFactory
in interfaceLanguageConnectionFactory
-
getClassFactory
public ClassFactory getClassFactory()
Get the ClassFactory to use with this language connection- Specified by:
getClassFactory
in 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:
getJavaFactory
in interfaceLanguageConnectionFactory
-
getExecutionFactory
public ExecutionFactory getExecutionFactory()
Get the ExecutionFactory to use with this language connection- Specified by:
getExecutionFactory
in interfaceLanguageConnectionFactory
-
getPropertyFactory
public PropertyFactory getPropertyFactory()
Get the PropertyFactory to use with this language connection- Specified by:
getPropertyFactory
in interfaceLanguageConnectionFactory
-
getOptimizerFactory
public OptimizerFactory getOptimizerFactory()
Get the OptimizerFactory to use with this language connection- Specified by:
getOptimizerFactory
in interfaceLanguageConnectionFactory
-
getTypeCompilerFactory
public TypeCompilerFactory getTypeCompilerFactory()
Get the TypeCompilerFactory to use with this language connection- Specified by:
getTypeCompilerFactory
in interfaceLanguageConnectionFactory
-
getDataValueFactory
public DataValueFactory getDataValueFactory()
Get the DataValueFactory to use with this language connection- Specified by:
getDataValueFactory
in interfaceLanguageConnectionFactory
-
canSupport
public boolean canSupport(java.util.Properties startParams)
this implementation will not support caching of statements.- Specified by:
canSupport
in 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 StandardException
Start-up method for this instance of the language connection factory. Note these are expected to be booted relative to a Database.- Specified by:
boot
in 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:
getStatementCache
in interfaceLanguageConnectionFactory
-
stop
public void stop()
Stop this module.- Specified by:
stop
in interfaceModuleControl
- See Also:
Monitor
,ModuleFactory
-
init
public void init(boolean dbOnly, java.util.Dictionary p)
Description copied from interface:PropertySetCallback
Initialize 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:
init
in 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 StandardException
Description copied from interface:PropertySetCallback
Validate a property change.- Specified by:
validate
in 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:PropertySetCallback
Apply 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:
apply
in 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:PropertySetCallback
Map a proposed new value for a property to an official value. Will only be called after apply() has been called.- Specified by:
map
in 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:
newParser
in 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 StandardException
Privileged 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 StandardException
Privileged 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 StandardException
Privileged 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 StandardException
Privileged 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.
-
-