UnitConfiguration unitConfiguration
= controllerState.getUnitConfiguration();
ConfigurationHandlers configurationHandlers
= unitConfiguration.getConfigurationHandlers();
Controller helperController = new Controller();
SourceElement newSourceElement = new SourceElement(newElement);
boolean newSourceElementAdded = false;
try
{
// do not change state of original source provider,
// instead make a copy.
SourceProvider sourceProvider
= controllerState.getSourceProvider().copy();
sourceProvider.init(configurationHandlers, controllerState);
while (sourceProvider.hasNext())
{
Source source = sourceProvider.next();
SourceElement rootElement = source.getRootElement();
SourceProcessConfiguration sourceProcessConfiguration
= output.getSourceProcessConfiguration();
List<SourceTransformerDefinition> transformerDefinitions
= sourceProcessConfiguration.getTransformerDefinitions();
transformerDefinitions
= new ArrayList<SourceTransformerDefinition>
(transformerDefinitions);
Iterator<SourceTransformerDefinition> transformerDefinitionIt
= transformerDefinitions.iterator();
while (transformerDefinitionIt.hasNext())
{
SourceTransformerDefinition transformerDefinition
= transformerDefinitionIt.next();
if (this.equals(
transformerDefinition.getSourceTransformer()))
{
transformerDefinitionIt.remove();
}
}
rootElement = helperController.transformSource(
rootElement,
transformerDefinitions,
controllerState);
newSourceElement.getChildren().add(rootElement);