String resolvedPrefix = this.prefix.resolve(context, objectModel);
if (resolvedSource.length() == 0) {
throw new ProcessingException("Source of mount statement is empty");
}
TreeProcessor processor = getProcessor(resolvedSource);
// Save context
String oldPrefix = env.getURIPrefix();
String oldURI = env.getURI();
String oldContext = env.getContext();
Object oldPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
env.setAttribute(COCOON_PASS_THROUGH, BooleanUtils.toBooleanObject(passThrough));
boolean pipelineWasBuilt = false;
try {
env.changeContext(resolvedPrefix, resolvedSource);
if (context.isBuildingPipelineOnly()) {
// Propagate pipelines
ProcessingPipeline pp = processor.buildPipeline(env);
if (pp != null) {
context.setProcessingPipeline( pp );
pipelineWasBuilt = true;
}
} else {
// Processor will create its own pipelines
pipelineWasBuilt = processor.process(env);
}
} finally {
// We restore the context only if no pipeline was built. This allows the pipeline
// environment to be left unchanged when we go back to ancestor processors.
// If no pipeline was built, we restore the context, so that the current processor