KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
insertStage.setReceiver( executeResultHandler );
Smooks smooks = new Smooks( getClass().getResourceAsStream( "smooks-config.xml" ) );
Transformer transformer = PipelineFactory.newSmooksFromSourceTransformer( smooks,
"root" );
transformer.setReceiver( insertStage );
Pipeline pipeline = PipelineFactory.newStatefulKnowledgeSessionPipeline( ksession );
pipeline.setReceiver( transformer );
ResultHandlerImpl resultHandler = new ResultHandlerImpl();
pipeline.insert( new StreamSource( getClass().getResourceAsStream( "SmooksNestedIterable.xml" ) ),
resultHandler );
FactHandle factHandle = ( FactHandle ) ((Map)resultHandler.getObject()).keySet().iterator().next();
assertNotNull( factHandle );
// now round trip that fact
Action executeResult = PipelineFactory.newExecuteResultHandler();
Action assignAsResult = PipelineFactory.newAssignObjectAsResult();
assignAsResult.setReceiver( executeResult );
transformer = PipelineFactory.newSmooksToSourceTransformer( smooks );
transformer.setReceiver( assignAsResult );
KnowledgeRuntimeCommand getObject = PipelineFactory.newStatefulKnowledgeSessionGetObject();
getObject.setReceiver( transformer );
pipeline = PipelineFactory.newStatefulKnowledgeSessionPipeline( ksession );