public abstract class RecordAccessor extends AbstractDataAccessor<DataRecord,DataRecord>
Constructor and Description |
---|
RecordAccessor() |
Modifier and Type | Method and Description |
---|---|
void |
addFieldHandler(java.lang.String fieldName,
FieldHandler handler)
Add a field handler for a particular field.
|
protected void |
addToGraph(Graph<DataRecord,DataRecord> graph,
GraphSpec spec)
Add a set of records to the graph provided.
|
protected Tree<DataRecord> |
addToTree(Tree<DataRecord> tree,
TreeSpec spec)
Add a set of records to the tree provided.
|
protected DataRecord |
createReferenceNode(DataRecord referrer,
java.lang.String name,
FieldDesc<?> desc)
Derive a data record for inclusion in a graph, tree, or other structure
based upon a referring node.
|
boolean |
extendGraph(java.lang.String graphName,
Graph<DataRecord,DataRecord> graph,
DataRecord node)
Extend the given graph around the specified node.
|
boolean |
extendTree(java.lang.String treeName,
Tree<DataRecord> tree,
DataRecord node)
Extend the given tree around the specified node.
|
java.util.Set<DataRecord> |
getDataset(java.lang.String datasetName)
Retrieve the dataset from the underlying data source.
|
FieldHandler |
getFieldHandler(java.lang.String fieldName)
Get the field handler associated with the specified field
|
Graph<DataRecord,DataRecord> |
getGraph(java.lang.String graphName)
Retrieve the graph from the underlying data source.
|
Grid<DataRecord> |
getGrid(java.lang.String gridName)
Retrieve the grid from the underlying data source.
|
int |
getMaxRecords()
Get the maximum number of records returned by this accessor on any
particular query.
|
RecordReasoner |
getReasoner(DataTemplate template)
Get the reasoner for the specified template for this accessor
|
java.util.Set<RecordReasoner> |
getStructureReasoners(java.lang.String dataName)
Get any reasoners which apply to the named data structure.
|
Tree<DataRecord> |
getTree(java.lang.String treeName)
Retrieve the tree from the underlying data source.
|
protected abstract java.util.Set<DataRecord> |
retrieveRecords(DataTemplate template)
Retrieve a set of data records for a particular DataTemplate.
|
void |
setMaxRecords(int recCnt)
Set the maximum number of records returned by this accessor on any
particular query.
|
void |
setReasoner(DataTemplate template,
RecordReasoner reasoner)
Set the reasoner for the template.
|
void |
setReasoner(java.lang.String templateName,
RecordReasoner reasoner)
Set the reasoner for the template.
|
addStructure, addTemplate, getDatasetNames, getGraphNames, getGridNames, getSpec, getStructureType, getTemplate, getTemplateNames, getTreeNames, setConfig, setConfigFile, setConfigFile, setQuery
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setInitParameters
public void addFieldHandler(java.lang.String fieldName, FieldHandler handler)
fieldName
- the data field within the DataRecordhandler
- the field handlerprotected final void addToGraph(Graph<DataRecord,DataRecord> graph, GraphSpec spec)
graph
- the current graphspec
- the current Graph specificationprotected final Tree<DataRecord> addToTree(Tree<DataRecord> tree, TreeSpec spec)
tree
- the current treespec
- the current tree specificationprotected DataRecord createReferenceNode(DataRecord referrer, java.lang.String name, FieldDesc<?> desc)
Derive a data record for inclusion in a graph, tree, or other structure based upon a referring node. This method is used when a data structure contains a reference to a record which is not available. For instance, this method is called when a graph contains an edge which refers to a node which is not in the current set of graph nodes, and cannot be retrieved from the underlying data source.
The default implementation simply creates an empty DataRecord with the provided name.
referrer
- the data record containing the reference to the nodename
- The name for the new Data Record.desc
- The field descriptor for the field containing the reference.public boolean extendGraph(java.lang.String graphName, Graph<DataRecord,DataRecord> graph, DataRecord node)
graphName
- The name of the graphgraph
- The graph to extendnode
- The node to use as an extension point.public boolean extendTree(java.lang.String treeName, Tree<DataRecord> tree, DataRecord node)
treeName
- The name of the graphtree
- The graph to extendnode
- The node to use as an extension point.public java.util.Set<DataRecord> getDataset(java.lang.String datasetName)
datasetName
- the name of the datasetpublic FieldHandler getFieldHandler(java.lang.String fieldName)
fieldName
- the name of the fieldpublic Graph<DataRecord,DataRecord> getGraph(java.lang.String graphName)
graphName
- the name of the graphpublic Grid<DataRecord> getGrid(java.lang.String gridName)
gridName
- the name of the gridpublic int getMaxRecords()
public RecordReasoner getReasoner(DataTemplate template)
template
- the data templatepublic java.util.Set<RecordReasoner> getStructureReasoners(java.lang.String dataName)
dataName
- the name of the data structurepublic Tree<DataRecord> getTree(java.lang.String treeName)
treeName
- the name of the treeprotected abstract java.util.Set<DataRecord> retrieveRecords(DataTemplate template)
template
- The data template specifying field mappings and
descriptionspublic void setMaxRecords(int recCnt)
recCnt
- the number of records returnedpublic void setReasoner(DataTemplate template, RecordReasoner reasoner)
retrieveRecords
method for the specified template.template
- the data templatereasoner
- the reasoner to setpublic void setReasoner(java.lang.String templateName, RecordReasoner reasoner)
retrieveRecords
method for the specified template.templateName
- the data template namereasoner
- the reasoner to set