SMACS

smacs.load.mapping
Class DbMappingRecordSource

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.DbMappingRecordSource
All Implemented Interfaces:
Branch, Cloneable, CreateListener, DbMappingSimpleNode, Element, EventListener, FixNode, FixNodeListener, GetName, GetSimpleNode, HasNodeHandler, HasNodeReferenceAttribute, smacs.tree.HasNodeReferenceId, HasRecordFieldNameArray, IsaNodeReferenceChildListener, IsaNodeReferenceListener, NewSimpleNode, Node, Node, Serializable, SimpleElement, SimpleNode, SimpleNodeChild, SmacsFixNode

public class DbMappingRecordSource
extends DbMappingScriptNode
implements HasRecordFieldNameArray

the layout of a possible tupel stream source.

If the record source happens to be a table reference then we can easily assign a hint on the type of the field and possibly more of its attributions. If it is a join expression then the tupel layout would need to be computed from that operation. Due to lack of time, we can not handle a join operator as a record source which does inadvertibly beat any field type assignments to hell. Sorry, and if there is someone with some time then please make a computation for the join operator and have each sql record field resolve to its column in the source schema tables.

Furthermore, remember that even after computing down a schema column the actual record field value might be the result of an operation - including aggregators. What counts is the result type of that operation of course. Computing the list of functions and tables involved has an advantage in that we could automatically compute interdependencies of sources - which in turn will allow to detect a possible parallel execution of mapping operations.

Well stop all those interesting things at a more simple task - the possibility to compute identical or overlapping input stream sources for a record builder as to possibly combine two mapping operations into a single execution loop over one actual cursor on the backend. Well, even that is not yet implemented but it is much easier and its implementation would provide some of the basic functionality needed for the real interesting resolution functions above.

Author:
Copyright (C) 2004, Guido Draheim. All rights reserved. Part of SMACS project.
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
DbMappingRecordSource(SmacsFixNodeLater later)
           
DbMappingRecordSource(SqlFromItemQ source)
           
 
Method Summary
 void addRecordField(String name, String type)
           
 void addSql(SqlFromItemQ source)
           
 int expandSourceTableColumns(DbSchemaTableList resolver)
           
 List getRecordFieldList()
           
 String getRecordFieldName(int i)
          fetch the name of a RecordField
 int getRecordFieldNameMax()
          the number of RecordField names registered.
 String getRecordFieldType(String name)
           
 SimpleNode getSql()
           
 NodeHandler getSqlQ()
           
 String getTableName()
           
 RecordFieldNode hasRecordField(String name)
           
 void setSql(SqlFromItemQ source)
           
 void setTableName(String name)
           
 
Methods inherited from class smacs.load.mapping.DbMappingScriptNode
_expandDistinctHints, _expandForeignKeyFieldDeclarationQ, _expandSchemaForeignKeyFieldDeclaration, _expandSchemaUniqueKeyFieldDeclaration, _expandSourceRecordColumns, _expandSourceRecordReferences, _expandSourceTableColumns, _expandSourceTableReferences, _expandUniqueKeyFieldDeclarationQ, expandDistinctHints, expandForeignKeyFieldDeclarationQ, expandSchemaForeignKeyFieldDeclaration, expandSchemaUniqueKeyFieldDeclaration, expandSourceRecordColumns, expandSourceRecordReferences, expandSourceTableReferences, 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

DbMappingRecordSource

public DbMappingRecordSource(SqlFromItemQ source)

DbMappingRecordSource

public DbMappingRecordSource(SmacsFixNodeLater later)
Method Detail

addSql

public void addSql(SqlFromItemQ source)

setSql

public void setSql(SqlFromItemQ source)

getSql

public SimpleNode getSql()

getSqlQ

public NodeHandler getSqlQ()

setTableName

public void setTableName(String name)

getTableName

public String getTableName()

expandSourceTableColumns

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

addRecordField

public void addRecordField(String name,
                           String type)

getRecordFieldList

public List getRecordFieldList()

hasRecordField

public RecordFieldNode hasRecordField(String name)

getRecordFieldType

public String getRecordFieldType(String name)

getRecordFieldNameMax

public int getRecordFieldNameMax()
Description copied from interface: HasRecordFieldNameArray
the number of RecordField names registered.

Specified by:
getRecordFieldNameMax in interface HasRecordFieldNameArray

getRecordFieldName

public String getRecordFieldName(int i)
Description copied from interface: HasRecordFieldNameArray
fetch the name of a RecordField

Specified by:
getRecordFieldName in interface HasRecordFieldNameArray

SMACS