org.apache.derby.impl.sql.conn
Class GenericLanguageConnectionFactory

java.lang.Object
  extended by 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
private  int cacheSize
           
private  ClassFactory classFactory
           
private  DataValueFactory dvf
           
private  ExecutionFactory ef
           
private  JavaFactory javaFactory
           
private  int nextLCCInstanceNumber
           
private  NodeFactory nodeFactory
           
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
GenericLanguageConnectionFactory()
           
 
Method Summary
 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.
 boolean canSupport(java.util.Properties startParams)
          this implementation will not support caching of statements.
 ClassFactory getClassFactory()
          Get the ClassFactory to use with this language connection
 DataValueFactory getDataValueFactory()
          Get the DataValueFactory to use with this language connection
 ExecutionFactory getExecutionFactory()
          Get the ExecutionFactory to use with this language connection
 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?
protected  int getNextLCCInstanceNumber()
          Get the instance # for the next LCC.
 NodeFactory getNodeFactory()
          Get the NodeFactory to use with this language connection REMIND: is this only used by the compiler?
 OptimizerFactory getOptimizerFactory()
          Get the OptimizerFactory to use with this language connection
 PropertyFactory getPropertyFactory()
          Get the PropertyFactory to use with this language connection
 Statement getStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean forReadOnly)
          Get a Statement for the connection
 CacheManager getStatementCache()
          returns the statement cache that this connection should use; currently there is a statement cache per connection.
 TypeCompilerFactory getTypeCompilerFactory()
          Get the TypeCompilerFactory to use with this language connection
 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?
 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  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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

nodeFactory

private NodeFactory nodeFactory

pf

private PropertyFactory pf

nextLCCInstanceNumber

private int nextLCCInstanceNumber

cacheSize

private int cacheSize

singleStatementCache

private CacheManager singleStatementCache
Constructor Detail

GenericLanguageConnectionFactory

public GenericLanguageConnectionFactory()
Method Detail

getStatement

public Statement getStatement(SchemaDescriptor compilationSchema,
                              java.lang.String statementText,
                              boolean forReadOnly)
Get a Statement for the connection

Specified by:
getStatement in interface LanguageConnectionFactory
Parameters:
compilationSchema - schema
statementText - the text for the statement
forReadOnly - 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 interface LanguageConnectionFactory
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 interface CacheableFactory

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 interface LanguageConnectionFactory

getClassFactory

public ClassFactory getClassFactory()
Get the ClassFactory to use with this language connection

Specified by:
getClassFactory in interface LanguageConnectionFactory

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 interface LanguageConnectionFactory

getNodeFactory

public NodeFactory getNodeFactory()
Get the NodeFactory to use with this language connection REMIND: is this only used by the compiler?

Specified by:
getNodeFactory in interface LanguageConnectionFactory

getExecutionFactory

public ExecutionFactory getExecutionFactory()
Get the ExecutionFactory to use with this language connection

Specified by:
getExecutionFactory in interface LanguageConnectionFactory

getPropertyFactory

public PropertyFactory getPropertyFactory()
Get the PropertyFactory to use with this language connection

Specified by:
getPropertyFactory in interface LanguageConnectionFactory

getOptimizerFactory

public OptimizerFactory getOptimizerFactory()
Get the OptimizerFactory to use with this language connection

Specified by:
getOptimizerFactory in interface LanguageConnectionFactory

getTypeCompilerFactory

public TypeCompilerFactory getTypeCompilerFactory()
Get the TypeCompilerFactory to use with this language connection

Specified by:
getTypeCompilerFactory in interface LanguageConnectionFactory

getDataValueFactory

public DataValueFactory getDataValueFactory()
Get the DataValueFactory to use with this language connection

Specified by:
getDataValueFactory in interface LanguageConnectionFactory

canSupport

public boolean canSupport(java.util.Properties startParams)
this implementation will not support caching of statements.

Specified by:
canSupport in interface ModuleSupportable
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 interface ModuleControl
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 connection.

Specified by:
getStatementCache in interface LanguageConnectionFactory

stop

public void stop()
Stop this module. In this case, nothing needs to be done.

Specified by:
stop in interface ModuleControl
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 interface PropertySetCallback
Parameters:
dbOnly - true if only per-database properties are to be looked at
p - 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 interface PropertySetCallback
Parameters:
key - Property key for the property being set
value - 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 interface PropertySetCallback
Parameters:
key - Property key for the property being set
value - 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 interface PropertySetCallback
Parameters:
key - Property key for the property being set
value - 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 interface LanguageConnectionFactory

getNextLCCInstanceNumber

protected int getNextLCCInstanceNumber()
Get the instance # for the next LCC. (Useful for logStatementText=true output.

Returns:
instance # of next LCC.

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.