SMACS

smacs.load.mapping
Class DbMappingSourceCursorNode

java.lang.Object
  extended byorg.dom4j.tree.AbstractNode
      extended byorg.dom4j.tree.AbstractBranch
          extended byorg.dom4j.tree.AbstractElement
              extended byorg.dom4j.tree.DefaultElement
                  extended bysmacs.tree.ScriptNode
                      extended bysmacs.load.mapping.DbMappingScriptNode
                          extended bysmacs.load.mapping.DbMappingSourceCursorNode
All Implemented Interfaces:
Branch, Cloneable, CreateListener, DbMappingRecordFieldList, DbMappingSimpleNode, DbMappingSourceCursor, DbMappingSourceSelector, DbMappingSourceTableList, Element, EventListener, FixNode, FixNodeListener, GetName, GetSimpleNode, HasNodeHandler, HasNodeReferenceAttribute, smacs.tree.HasNodeReferenceId, HasRecordFieldNameArray, IsaNodeReferenceChildListener, IsaNodeReferenceListener, NewSimpleNode, Node, Node, Serializable, SimpleElement, SimpleNode, SimpleNodeChild, SmacsFixNode

public class DbMappingSourceCursorNode
extends DbMappingScriptNode
implements DbMappingSourceCursor, DbMappingRecordFieldList

implementation of data source. has a (a) list of record fields in the SELECT (b) more test constraints that be used to to check overlapping queries (c) explicit cursor options that define interrelation of source cursors.

See Also:
Serialized Form

Field Summary
protected static Logger log
           
 
Fields inherited from class smacs.tree.ScriptNode
_NodeHandler, TokenValue
 
Fields inherited from class org.dom4j.tree.AbstractElement
EMPTY_ITERATOR, EMPTY_LIST, USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING
 
Fields inherited from class org.dom4j.tree.AbstractBranch
DEFAULT_CONTENT_LIST_SIZE, outputFormat
 
Fields inherited from class org.dom4j.tree.AbstractNode
NODE_TYPE_NAMES
 
Fields inherited from interface smacs.tree.SimpleNode
TokenValue
 
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE
 
Constructor Summary
DbMappingSourceCursorNode(SmacsFixNodeLater later)
          constructor. reloading.
DbMappingSourceCursorNode(SqlSelectStatementQ select)
          constructor. from full select statment (isFullSelectStatement())
DbMappingSourceCursorNode(SqlSelectWhereClauseQ select)
          constructor. from simple source statment (isOnlySelectWhere())
DbMappingSourceCursorNode(SqlSelectWhereClauseQ select, SqlFromClauseQ source)
          constructor. from simple source statment (isOnlySelectWhere())
 
Method Summary
 void addDbMappingRecordField(DbMappingRecordField field)
          add a field name to the record definition.
 void addDbMappingRecordSource(DbMappingRecordSource source)
          add to resolved record source list.
 void addSqlFromClauseQ(SqlFromClauseQ source)
          set ref to sql table source syntax.
 void addSqlMaterializedCursorQ(SqlMaterializedCursorQ hint)
          set cursor option to materialize . direct via sql syntax
 void addSqlMaterializedCursorQ(SqlWithOptionsQ options)
          set cursor option to materialize . indirect via sql optionlist syntax
 void addSqlSelectStatementQ(SqlSelectStatementQ select)
          set ref to sql source syntax.
 void addSqlSelectWhereClauseQ(SqlSelectWhereClauseQ select)
          set ref to sql where syntax.
 int expandSourceRecordColumns(DbSchemaTableList resolver)
           
 int expandSourceRecordColumnTypes(DbSchemaTableList resolver)
           
 int expandSourceRecordReferences(DbSchemaTableList resolver)
           
 int expandSourceTableColumns(DbSchemaTableList resolver)
           
 int expandSourceTableReferences(DbSchemaTableList resolver)
           
 DbMappingRecordSource findColumnRecordSource(String column, String table, String schema)
          called from expandSourceRecordColumnTypes(smacs.load.schema.DbSchemaTableList)
 String getCursorOption(int i)
          get cursor option variant as name .
 DbMappingRecordField getDbMappingRecordField(int i)
          get resolved record field by index.
 DbMappingRecordField getDbMappingRecordField(String name)
          get resolved record field by name.
 List getDbMappingRecordFieldList()
          the field list.
 int getDbMappingRecordFieldMax()
          get resolved record field list size.
 DbMappingRecordSource getDbMappingRecordSource(int i)
          get resolved record source by index.
 DbMappingRecordSource getDbMappingRecordSource(String name)
          get resolved record source by name.
 List getDbMappingRecordSourceList()
          get resolved record source list.
 String getRecordFieldName(int i)
          get name of field as given in select list item.
 int getRecordFieldNameMax()
          get size of list of names of select list items.
 SimpleNode getRecordFieldSqlNode(int i)
          get sql of select list item.
 SimpleNode getRecordFieldSqlNode(String name)
          ref sql of record field. getDbMappingRecordField(name).getSqlOfExpression()
 SimpleNode getRecordFieldSqlNode(String name, String table, String schema)
          unused.
 SimpleNode getSchemaTableSqlNode(int i)
          ref sql of record source. getDbMappingRecordSource(i).getSql()
 SimpleNode getSchemaTableSqlNode(String name)
          unused.
 SimpleNode getSchemaTableSqlNode(String name, String schema)
          unused.
 SimpleNode getSql()
          get ref to sql source syntax (if any).
 SimpleNode getSqlCondition()
          get sql of where condition.
 SqlFromClauseQ hasSqlFromClauseQ()
          get ref to sql table source syntax.
 SqlMaterializedCursorQ hasSqlMaterializedCursorQ()
          get cursor option to materialize .
 SqlSelectStatementQ hasSqlSelectStatementQ()
          get ref to sql source syntax (if any).
 SqlSelectWhereClauseQ hasSqlSelectWhereClauseQ()
          get ref to sql where syntax (if any).
 boolean isFullSelectStatement()
          check if ref to sql source syntax (if any).
 boolean isOnlySelectWhere()
          check if only where clause.
 
Methods inherited from class smacs.load.mapping.DbMappingScriptNode
_expandDistinctHints, _expandForeignKeyFieldDeclarationQ, _expandSchemaForeignKeyFieldDeclaration, _expandSchemaUniqueKeyFieldDeclaration, _expandSourceRecordColumns, _expandSourceRecordReferences, _expandSourceTableColumns, _expandSourceTableReferences, _expandUniqueKeyFieldDeclarationQ, expandDistinctHints, expandForeignKeyFieldDeclarationQ, expandSchemaForeignKeyFieldDeclaration, expandSchemaUniqueKeyFieldDeclaration, expandUniqueKeyFieldDeclarationQ, newNode, newNode, newNode
 
Methods inherited from class smacs.tree.ScriptNode
_fixNodeTree, _getTokenValue, _getValueTokenValue, _hasTokenValue, _init, add, add, addAll, addAll, addChild, addChild, addNewNode, addNodeReference, addNodeReference, addNodeReference, addNodeReference, appendAttributes, appendText, clear, cloneFrom, contains, containsAll, countTokenName, dump, fireNodeReferenceChildHasChanged, fireNodeReferenceHasChanged, firstTokenName, firstTokenName, fixNode, fixNodeTree, get, getAttributeValue, getHandler, getId, getMember, getMember, getMember, getMember, getMemberChild, getMemberChild, getMemberChild, getMemberList, getMemberListChild, getMemberOption, getMemberOption, getMemberOption, getMemberValue, getMemberValue, getMemberValue, getNodeNameFromClassName, getNodeReferenceCount, getNodeReferenceCount, getNodeReferenceId, getNodeReferenceId, getOption, getOption, getOption, getParentNode, getParentNode, getParentNode, getParentNode, getSimpleNode, getSingleTextChild, getThisParentNode, getThisParentNode, getTokenName, getTokenValue, hasChildren, hasMember, hasMember, hasNodeHandler, hasNodeReference, hasNodeReferenceChildNodes, hasNodeReferenceChildNodes, hasNodeReferenceId, hasNodeReferenceId, hasSingleTextChild, hasTokenName, hasTokenValue, indexOf, isEmpty, iterator, jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, lastIndexOf, lastTokenName, lastTokenName, listIterator, listIterator, memberElement, newChildren, newNode, newNode, newNode, newNode, newNode, newNode, newNode, newNodeLike, newNodeReferenceAttribute, newNodeReferenceAttribute, newNodeReferenceId, newNodeReferenceId, onNodeReferenceChildHasChanged, onNodeReferenceHasChanged, printXML, printXML, removeAll, removeAttribute, removeChild, removeChild, removeNodeReference, replace, retainAll, set, setHandler, setMemberChild, setMemberChild, setMemberChild, setMemberList, setMemberListChild, setMemberOption, setMemberOption, setMemberOption, setMemberValue, setMemberValue, setMemberValue, setNodeReference, setNodeReference, setNodeReference, setOption, setOption, setOption, setOption, setTokenName, setTokenValue, size, strSingleTextChild, subList, toArray, toArray, toString, toString, toXML, toXML
 
Methods inherited from class org.dom4j.tree.DefaultElement
add, additionalNamespaces, additionalNamespaces, addNewNode, attribute, attribute, attribute, attribute, attributeCount, attributeIterator, attributeList, attributeList, attributes, clearContent, clone, contentList, declaredNamespaces, element, element, element, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, getDocument, getDocumentFactory, getNamespaceForPrefix, getNamespaceForURI, getParent, getQName, getStringValue, getText, indexOf, node, nodeCount, nodeIterator, processingInstruction, processingInstructions, processingInstructions, remove, removeNode, removeProcessingInstruction, setAttributeList, setAttributes, setContent, setDocument, setParent, setQName, supportsParent
 
Methods inherited from class org.dom4j.tree.AbstractElement
accept, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, addNamespace, addNode, addProcessingInstruction, addProcessingInstruction, addText, asXML, attributeValue, attributeValue, attributeValue, attributeValue, childAdded, childRemoved, createAttributeList, createAttributeList, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getData, getName, getNamespace, getNamespacePrefix, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, isRootElement, isTextOnly, normalize, remove, remove, remove, remove, remove, remove, remove, remove, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, write
 
Methods inherited from class org.dom4j.tree.AbstractBranch
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructions
 
Methods inherited from class org.dom4j.tree.AbstractNode
asXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface smacs.tree.SimpleNode
add, add, addAll, addAll, addChild, addChild, addNewNode, addNodeReference, addNodeReference, addNodeReference, addNodeReference, appendAttributes, appendText, clear, cloneFrom, contains, containsAll, countTokenName, dump, fireNodeReferenceChildHasChanged, fireNodeReferenceHasChanged, firstTokenName, firstTokenName, fixNode, fixNodeTree, get, getAttributeValue, getHandler, getId, getMember, getMember, getMember, getMember, getMemberChild, getMemberChild, getMemberChild, getMemberList, getMemberListChild, getMemberOption, getMemberOption, getMemberOption, getMemberValue, getMemberValue, getMemberValue, getNodeReferenceCount, getNodeReferenceCount, getNodeReferenceId, getNodeReferenceId, getOption, getOption, getOption, getParentNode, getParentNode, getParentNode, getParentNode, getSimpleNode, getSingleTextChild, getThisParentNode, getThisParentNode, getTokenName, getTokenValue, hasChildren, hasMember, hasMember, hasNodeHandler, hasNodeReference, hasNodeReferenceChildNodes, hasNodeReferenceChildNodes, hasNodeReferenceId, hasNodeReferenceId, hasSingleTextChild, hasTokenName, hasTokenValue, indexOf, isEmpty, iterator, jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, lastIndexOf, lastTokenName, lastTokenName, listIterator, listIterator, memberElement, newChildren, newNode, newNode, newNode, newNode, newNode, newNode, newNode, newNodeReferenceAttribute, onNodeReferenceChildHasChanged, onNodeReferenceHasChanged, printXML, printXML, removeAll, removeAttribute, removeChild, removeChild, removeNodeReference, replace, retainAll, set, setHandler, setMemberChild, setMemberChild, setMemberChild, setMemberList, setMemberListChild, setMemberOption, setMemberOption, setMemberOption, setMemberValue, setMemberValue, setMemberValue, setNodeReference, setNodeReference, setNodeReference, setOption, setOption, setOption, setOption, setTokenName, setTokenValue, size, strSingleTextChild, subList, toArray, toArray, toString, toString, toXML, toXML
 
Methods inherited from interface org.dom4j.Element
add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addEntity, additionalNamespaces, addNamespace, addProcessingInstruction, addProcessingInstruction, addText, attribute, attribute, attribute, attributeCount, attributeIterator, attributes, attributeValue, attributeValue, attributeValue, attributeValue, createCopy, createCopy, createCopy, declaredNamespaces, element, element, elementIterator, elementIterator, elementIterator, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, getData, getNamespace, getNamespaceForPrefix, getNamespaceForURI, getNamespacePrefix, getNamespaceURI, getQName, getQName, getQualifiedName, getStringValue, getText, getTextTrim, getXPathResult, hasMixedContent, isRootElement, isTextOnly, remove, remove, remove, remove, remove, setAttributes, setAttributeValue, setAttributeValue, setData, setQName
 
Methods inherited from interface org.dom4j.Branch
add, add, add, add, addElement, addElement, addElement, appendContent, clearContent, content, elementByID, indexOf, node, nodeCount, nodeIterator, normalize, processingInstruction, processingInstructions, processingInstructions, remove, remove, remove, remove, removeProcessingInstruction, setContent, setProcessingInstructions
 
Methods inherited from interface org.dom4j.Node
accept, asXML, asXPathResult, clone, createXPath, detach, getDocument, getName, getNodeType, getNodeTypeName, getParent, getPath, getPath, getUniquePath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write
 
Methods inherited from interface smacs.util.listen.GetName
getName
 

Field Detail

log

protected static final Logger log
Constructor Detail

DbMappingSourceCursorNode

public DbMappingSourceCursorNode(SqlSelectStatementQ select)
constructor. from full select statment (isFullSelectStatement())


DbMappingSourceCursorNode

public DbMappingSourceCursorNode(SqlSelectWhereClauseQ select)
constructor. from simple source statment (isOnlySelectWhere())


DbMappingSourceCursorNode

public DbMappingSourceCursorNode(SqlSelectWhereClauseQ select,
                                 SqlFromClauseQ source)
constructor. from simple source statment (isOnlySelectWhere())


DbMappingSourceCursorNode

public DbMappingSourceCursorNode(SmacsFixNodeLater later)
constructor. reloading.

Method Detail

isFullSelectStatement

public boolean isFullSelectStatement()
check if ref to sql source syntax (if any). May also be degenerated.


isOnlySelectWhere

public boolean isOnlySelectWhere()
check if only where clause. As for degenerated definitions reading from one table.


getSql

public SimpleNode getSql()
get ref to sql source syntax (if any).


hasSqlSelectStatementQ

public SqlSelectStatementQ hasSqlSelectStatementQ()
get ref to sql source syntax (if any).

Specified by:
hasSqlSelectStatementQ in interface DbMappingSourceCursor

hasSqlSelectWhereClauseQ

public SqlSelectWhereClauseQ hasSqlSelectWhereClauseQ()
get ref to sql where syntax (if any).

Specified by:
hasSqlSelectWhereClauseQ in interface DbMappingSourceCursor

addSqlSelectStatementQ

public void addSqlSelectStatementQ(SqlSelectStatementQ select)
set ref to sql source syntax.


addSqlSelectWhereClauseQ

public void addSqlSelectWhereClauseQ(SqlSelectWhereClauseQ select)
set ref to sql where syntax.


addSqlFromClauseQ

public void addSqlFromClauseQ(SqlFromClauseQ source)
set ref to sql table source syntax.


hasSqlFromClauseQ

public SqlFromClauseQ hasSqlFromClauseQ()
get ref to sql table source syntax.


hasSqlMaterializedCursorQ

public SqlMaterializedCursorQ hasSqlMaterializedCursorQ()
get cursor option to materialize .


addSqlMaterializedCursorQ

public void addSqlMaterializedCursorQ(SqlMaterializedCursorQ hint)
set cursor option to materialize . direct via sql syntax


addSqlMaterializedCursorQ

public void addSqlMaterializedCursorQ(SqlWithOptionsQ options)
set cursor option to materialize . indirect via sql optionlist syntax


getCursorOption

public String getCursorOption(int i)
get cursor option variant as name .

Specified by:
getCursorOption in interface DbMappingSourceCursor

getRecordFieldSqlNode

public SimpleNode getRecordFieldSqlNode(String name)
ref sql of record field. getDbMappingRecordField(name).getSqlOfExpression()

Specified by:
getRecordFieldSqlNode in interface DbMappingSourceTableList

getRecordFieldSqlNode

public SimpleNode getRecordFieldSqlNode(String name,
                                        String table,
                                        String schema)
unused.

Specified by:
getRecordFieldSqlNode in interface DbMappingSourceTableList

getSchemaTableSqlNode

public SimpleNode getSchemaTableSqlNode(String name)
unused.

Specified by:
getSchemaTableSqlNode in interface DbMappingSourceTableList

getSchemaTableSqlNode

public SimpleNode getSchemaTableSqlNode(String name,
                                        String schema)
unused.

Specified by:
getSchemaTableSqlNode in interface DbMappingSourceTableList

getSchemaTableSqlNode

public SimpleNode getSchemaTableSqlNode(int i)
ref sql of record source. getDbMappingRecordSource(i).getSql()

Specified by:
getSchemaTableSqlNode in interface DbMappingSourceTableList

getRecordFieldSqlNode

public SimpleNode getRecordFieldSqlNode(int i)
get sql of select list item.

Specified by:
getRecordFieldSqlNode in interface DbMappingSourceSelector

getSqlCondition

public SimpleNode getSqlCondition()
get sql of where condition.

Specified by:
getSqlCondition in interface DbMappingSourceSelector

getRecordFieldName

public String getRecordFieldName(int i)
get name of field as given in select list item.

Specified by:
getRecordFieldName in interface DbMappingSourceCursor

getRecordFieldNameMax

public int getRecordFieldNameMax()
get size of list of names of select list items.

Specified by:
getRecordFieldNameMax in interface DbMappingSourceCursor

getDbMappingRecordSource

public DbMappingRecordSource getDbMappingRecordSource(String name)
get resolved record source by name.


getDbMappingRecordSource

public DbMappingRecordSource getDbMappingRecordSource(int i)
get resolved record source by index.


getDbMappingRecordSourceList

public List getDbMappingRecordSourceList()
get resolved record source list.


addDbMappingRecordSource

public void addDbMappingRecordSource(DbMappingRecordSource source)
add to resolved record source list.


getDbMappingRecordField

public DbMappingRecordField getDbMappingRecordField(String name)
get resolved record field by name.


getDbMappingRecordField

public DbMappingRecordField getDbMappingRecordField(int i)
get resolved record field by index.

Specified by:
getDbMappingRecordField in interface DbMappingSourceSelector

getDbMappingRecordFieldMax

public int getDbMappingRecordFieldMax()
get resolved record field list size.


getDbMappingRecordFieldList

public List getDbMappingRecordFieldList()
the field list. This is usually the expanded field list unless the internal mechanics were unable to expand a starfield - in that case we try to let the later stages to do its work and return the unexpended fieldlist.

Specified by:
getDbMappingRecordFieldList in interface DbMappingRecordFieldList

addDbMappingRecordField

public void addDbMappingRecordField(DbMappingRecordField field)
add a field name to the record definition. If it is a starfield we try to expand the name list right away into a secondary set of expanded field names.


expandSourceRecordReferences

public int expandSourceRecordReferences(DbSchemaTableList resolver)
Specified by:
expandSourceRecordReferences in interface DbMappingSimpleNode
Overrides:
expandSourceRecordReferences in class DbMappingScriptNode

expandSourceTableReferences

public int expandSourceTableReferences(DbSchemaTableList resolver)
Specified by:
expandSourceTableReferences in interface DbMappingSimpleNode
Overrides:
expandSourceTableReferences in class DbMappingScriptNode

expandSourceTableColumns

public int expandSourceTableColumns(DbSchemaTableList resolver)
Specified by:
expandSourceTableColumns in interface DbMappingSimpleNode
Overrides:
expandSourceTableColumns in class DbMappingScriptNode

expandSourceRecordColumns

public int expandSourceRecordColumns(DbSchemaTableList resolver)
Specified by:
expandSourceRecordColumns in interface DbMappingSimpleNode
Overrides:
expandSourceRecordColumns in class DbMappingScriptNode

expandSourceRecordColumnTypes

public int expandSourceRecordColumnTypes(DbSchemaTableList resolver)

findColumnRecordSource

public DbMappingRecordSource findColumnRecordSource(String column,
                                                    String table,
                                                    String schema)
called from expandSourceRecordColumnTypes(smacs.load.schema.DbSchemaTableList)


SMACS