ServerProxy server,
DataRequestExecutionResource drer)
throws Exception
{
CreateDataCache createCache = new CreateDataCache();
DeliverToRequestStatus deliver = new DeliverToRequestStatus();
deliver.connectInput(createCache.getResultOutput());
PipelineWorkflow workflow = new PipelineWorkflow();
workflow.add(createCache);
workflow.add(deliver);
executeWorkflow(drer, workflow);
ResourceID cacheID = createCache.nextResult();
String sql = "SELECT name, address FROM littleblackbook WHERE id<100";
SQLQuery query = new SQLQuery();
query.addExpression(sql);
query.setResourceID("MySQLResource");
WriteToDataCache write = new WriteToDataCache();
write.setResourceID(cacheID);
write.connectDataInput(query.getDataOutput());
PipelineWorkflow toCache = new PipelineWorkflow();
toCache.add(query);
toCache.add(write);
ReadFromDataCache read = new ReadFromDataCache();
read.setResourceID(cacheID);
TupleToWebRowSetCharArrays tupleToWRS = new TupleToWebRowSetCharArrays();
tupleToWRS.connectDataInput(read.getResultOutput());
deliver = new DeliverToRequestStatus();
deliver.connectInput(tupleToWRS.getResultOutput());
PipelineWorkflow fromCache = new PipelineWorkflow();
fromCache.add(read);
fromCache.add(tupleToWRS);
fromCache.add(deliver);
SequenceWorkflow sequence = new SequenceWorkflow();
sequence.add(toCache);
sequence.add(fromCache);
long start = System.currentTimeMillis();
executeWorkflow(drer, sequence);
long stop = System.currentTimeMillis();
server.getDataResource(cacheID).destroy();
System.out.println("DATA CACHE: " + (stop-start) + "ms");
query = new SQLQuery();
query.addExpression(sql);
query.setResourceID("MySQLResource");
tupleToWRS = new TupleToWebRowSetCharArrays();
tupleToWRS.connectDataInput(query.getDataOutput());
deliver = new DeliverToRequestStatus();
deliver.connectInput(tupleToWRS.getResultOutput());
workflow = new PipelineWorkflow();
workflow.add(query);
workflow.add(tupleToWRS);
workflow.add(deliver);