public class DataAssembler
extends java.lang.Object
DataAssembler combines the data from ObjectLinker's database into final wrapper objects they can be used by Processing. To do that it iterates through the database tables and invokes functions. The <assembling> section from linking schema defines iterations and function calls.
The DataAssembler works recursively in natural order. Functions can be placed into iterations and iterations can be nested. However, nested functions is not allowed.
The functions themselves are located in package "asmbeans" and beeing invoked via system class loader. They should do tiny helper jobs and DataAssembler should manage the whole procedure. Each function must have must have a method header like "public static [Object|void] functionName(ArrayList<Param> paramlist)"
A next important part is the IO stub. The end results from the whole procedure must be returned to user on the other hand there may be some options coming from user what some functions need.
The input is realized via user options. (java.util.Properties). The output results goes via LoadingListener as callback. On startup ColladaLoader creates an empty listener and commit it here.
Such Class what handles this I/O relations is located in "asmbeans" package, is defined in <interface> section of linking schema, and must have a constructor like "MyName(Properties colladaMetaData, DataAssembler.LoadingListener ltnr)"
The class has a main test method and depends on ObjectLinker SaxParser SimpleDomParser Log and in linking schema defined assembler classes
This source is free; you can redistribute it and/or modify it under the terms of the GNU General Public License and by nameing of the originally author
| Modifier and Type | Class and Description |
|---|---|
static class |
DataAssembler.Job
contain all infos to do assembling job at runtime
A Job may be an iteration or a function
|
static interface |
DataAssembler.LoadingListener
Is invoked by assembling classes if any processing
objects is parsed /ready to draw
|
private static class |
DataAssembler.MyIterable
wrapps children array from a Record into a Iterable object
|
static class |
DataAssembler.Param
A wrapper for the inparams to static methods from
in package "asmbeans"
|
static class |
DataAssembler.Variable
a Descriptor to establish fixed links from Job to Job
|
| Constructor and Description |
|---|
DataAssembler() |
| Modifier and Type | Method and Description |
|---|---|
private void |
addDescriptorsFromDB(java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs,
java.util.HashMap<java.lang.String,java.util.TreeMap<java.lang.String,SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo>>> db)
adds into named descriptors the database
from ObjectLinker.
|
private void |
addFunctionDescriptors(DataAssembler.Job root)
goes through the Job tree recursively.
|
private void |
createJobTreeSkel(SimpleDomParser.Element assembling,
DataAssembler.Job parent)
scans the xml element <assembling> recursively and
writes/maps its structure into Job "parent".It sets
for each subjob a flag (for function or iteration) and String attributes
defined in xml.
|
private void |
getOutDescriptorsFromJobSkel(DataAssembler.Job root,
java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs)
Searches Job tree for "tuple" and "result" definitions
recursively and gives them an output descriptor.
|
private void |
hardLinkIoDescriptors(DataAssembler.Job root,
java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs)
establish recursively hard links to all I/O descriptors
so each job has now a IN / OUT to the correct neighbours
|
DataAssembler.Job |
init(java.lang.String linkerSchema,
java.util.HashMap<java.lang.String,java.util.TreeMap<java.lang.String,SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo>>> linkerDatabase,
java.util.Properties colladaMetaData,
DataAssembler.LoadingListener assembingCallback)
Main initial: parses LinkingSchema for jobs and gives
back a valid tree of listed/nested jobs (function calls or iterations)
with valid and linked descriptors for env vars, database
interface or functions
|
private SimpleDomParser.Element |
parseSchema(java.lang.String filename)
parses the xml linking schema as DOM Model
should be placed into jar://ch/dieseite/colladaloader/coreproc
|
void |
recursiveJobIteration(DataAssembler.Job js)
Starts recursively all defined iterations and
Functions defined inside <assembling> in natural
order.
|
private void |
setInterfaceDescriptor(java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs,
SimpleDomParser.Element descr,
java.util.Properties colladaMetaData,
DataAssembler.LoadingListener callback)
put a named descriptor whose handle main I/O relations between
assembler classes and upper layer main class.
|
public DataAssembler.Job init(java.lang.String linkerSchema, java.util.HashMap<java.lang.String,java.util.TreeMap<java.lang.String,SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo>>> linkerDatabase, java.util.Properties colladaMetaData, DataAssembler.LoadingListener assembingCallback) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException, java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
linkerSchema - linkerDatabase - (created by ObjectLinker)colladaMetaData - startparams, the class defined in <interface> uses itassembingCallback, - the class defined in <interface> gives a callback if any processing Objects is ready to drawjavax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionjava.io.IOExceptionjava.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionjava.lang.ClassNotFoundExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionpublic void recursiveJobIteration(DataAssembler.Job js) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
js - root tree defined by linker xml filejava.lang.IllegalAccessExceptionjava.lang.IllegalArgumentExceptionjava.lang.reflect.InvocationTargetExceptionprivate SimpleDomParser.Element parseSchema(java.lang.String filename) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
filename - javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionjava.io.IOExceptionprivate void createJobTreeSkel(SimpleDomParser.Element assembling, DataAssembler.Job parent)
assembling - parent - rootprivate void addDescriptorsFromDB(java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs, java.util.HashMap<java.lang.String,java.util.TreeMap<java.lang.String,SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo>>> db)
outputs - named descriptorsdb - private void getOutDescriptorsFromJobSkel(DataAssembler.Job root, java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs)
root - outputs - an empty Map, after method call it contains named descriptorsprivate void hardLinkIoDescriptors(DataAssembler.Job root, java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs)
root - treeoutputs - all (particularly empty) IO descriptorsdb - from ObjectLinkerprivate void addFunctionDescriptors(DataAssembler.Job root) throws java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.ClassNotFoundException
root - java.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionjava.lang.ClassNotFoundExceptionprivate void setInterfaceDescriptor(java.util.HashMap<java.lang.String,DataAssembler.Variable> outputs, SimpleDomParser.Element descr, java.util.Properties colladaMetaData, DataAssembler.LoadingListener callback) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.ClassNotFoundException
outputs - named descriptors<interface> - tag from LinkingSchemacolladaMetaData - startparamsjava.lang.ClassNotFoundExceptionjava.lang.SecurityExceptionjava.lang.NoSuchMethodExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationException