org.apache.derby.impl.sql.compile
Class NodeFactoryImpl

java.lang.Object
  extended byorg.apache.derby.iapi.sql.compile.NodeFactory
      extended byorg.apache.derby.impl.sql.compile.NodeFactoryImpl
All Implemented Interfaces:
ModuleControl, ModuleSupportable

public class NodeFactoryImpl
extends NodeFactory
implements ModuleControl, ModuleSupportable

This class is a factory for QueryTreeNode nodes. It exists to provide methods to generate new nodes without having to call new directly. In the future, it may implement caching of nodes, as well, to avoid memory management and garbage collection.

Author:
Jeff Lichtman

Field Summary
private  java.lang.Boolean joinOrderOptimization
           
private  ClassInfo[] nodeCi
           
 
Fields inherited from class org.apache.derby.iapi.sql.compile.NodeFactory
MODULE
 
Constructor Summary
NodeFactoryImpl()
          Every Module needs a public niladic constructor.
 
Method Summary
 void boot(boolean create, java.util.Properties startParams)
          Boot this module with the given properties.
 boolean canSupport(java.util.Properties startParams)
          See if this implementation can support any attributes that are listed in properties.
 java.lang.Boolean doJoinOrderOptimization()
          Tell whether to do join order optimization.
 QueryTreeNode getCreateAliasNode(java.lang.Object aliasName, java.lang.Object targetName, java.lang.Object aliasSpecificInfo, char aliasType, java.lang.Boolean delimitedIdentifier, ContextManager cm)
          Get one of the several types of create alias nodes.
 QueryTreeNode getNode(int nodeType, ContextManager cm)
          Get a node that takes no initializer arguments.
protected  java.lang.String nodeName(int nodeType)
          Translate a node type from C_NodeTypes to a class name
 void stop()
          Stop the module.
 
Methods inherited from class org.apache.derby.iapi.sql.compile.NodeFactory
getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode, getNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

joinOrderOptimization

private java.lang.Boolean joinOrderOptimization

nodeCi

private final ClassInfo[] nodeCi
Constructor Detail

NodeFactoryImpl

public NodeFactoryImpl()
Every Module needs a public niladic constructor. It just does.

Method Detail

canSupport

public boolean canSupport(java.util.Properties startParams)
Description copied from interface: ModuleSupportable
See if this implementation can support any attributes that are listed in properties. This call may be made on a newly created instance before the boot() method has been called, or after the boot method has been called for a running module.

The module can check for attributes in the properties to see if it can fulfill the required behaviour. E.g. the raw store may define an attribute called RawStore.Recoverable. If a temporary raw store is required the property RawStore.recoverable=false would be added to the properties before calling bootServiceModule. If a raw store cannot support this attribute its canSupport method would return null. Also see the Monitor class's prologue to see how the identifier is used in looking up properties.
Actually a better way maybe to have properties of the form RawStore.Attributes.mandatory=recoverable,smallfootprint and RawStore.Attributes.requested=oltp,fast

Specified by:
canSupport in interface ModuleSupportable
Returns:
true if this instance can be used, false otherwise.

boot

public void boot(boolean create,
                 java.util.Properties startParams)
          throws StandardException
Description copied from interface: ModuleControl
Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned.

An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.

When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by cloudscape code, and thus must not be modified by cloudscape code.

When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.

Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.

Specified by:
boot in interface ModuleControl
Throws:
StandardException - Ooops
See Also:
Monitor

stop

public void stop()
Description copied from interface: ModuleControl
Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.

Specified by:
stop in interface ModuleControl
See Also:
Monitor

doJoinOrderOptimization

public java.lang.Boolean doJoinOrderOptimization()
Description copied from class: NodeFactory
Tell whether to do join order optimization.

Specified by:
doJoinOrderOptimization in class NodeFactory
Returns:
Boolean.TRUE means do join order optimization, Boolean.FALSE means don't do it.
See Also:
NodeFactory.doJoinOrderOptimization()

getNode

public QueryTreeNode getNode(int nodeType,
                             ContextManager cm)
                      throws StandardException
Description copied from class: NodeFactory
Get a node that takes no initializer arguments.

Specified by:
getNode in class NodeFactory
Parameters:
nodeType - Identifier for the type of node.
cm - A ContextManager
Returns:
A new QueryTree node.
Throws:
StandardException - Thrown on error
See Also:
NodeFactory.getNode(int, org.apache.derby.iapi.services.context.ContextManager)

nodeName

protected java.lang.String nodeName(int nodeType)
                             throws StandardException
Translate a node type from C_NodeTypes to a class name

Parameters:
nodeType - A node type identifier from C_NodeTypes
Throws:
StandardException - Thrown on error

getCreateAliasNode

public QueryTreeNode getCreateAliasNode(java.lang.Object aliasName,
                                        java.lang.Object targetName,
                                        java.lang.Object aliasSpecificInfo,
                                        char aliasType,
                                        java.lang.Boolean delimitedIdentifier,
                                        ContextManager cm)
                                 throws StandardException
Get one of the several types of create alias nodes. Carved out of parser so this could be used by ALTER PUBLICATION.

Specified by:
getCreateAliasNode in class NodeFactory
Parameters:
aliasName - The name of the alias
aliasSpecificInfo - The full path of the target method name, if any
aliasType - The type of alias to create
delimitedIdentifier - Whether or not to treat the class name as a delimited identifier if trying to resolve it as a class alias.
cm - A ContextManager
Returns:
A CreateAliasNode matching the given parameters
Throws:
StandardException - Thrown on error

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.