if (getLogger().isDebugEnabled()) {
getLogger().debug("Refreshing " + this.uri);
}
// Setup Environment
final BackgroundEnvironment env;
try {
org.apache.cocoon.environment.Context ctx =
(org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
env = new BackgroundEnvironment(ctx);
} catch (ContextException e) {
throw new CascadingRuntimeException("No context found", e);
}
Processor processor;
try {
processor = (Processor) manager.lookup(Processor.ROLE);
} catch (ServiceException e) {
throw new CascadingRuntimeException("No processor found", e);
}
env.startingProcessing();
try {
EnvironmentHelper.enterProcessor(processor, env);
} catch (ProcessingException e) {
throw new CascadingRuntimeException("Can not enter processor", e);
}
try {
// Refresh Source
Source source = null;
try {
source = resolver.resolveURI(uri);
source.refresh();
} catch (IOException e) {
getLogger().error("Error refreshing source", e);
} finally {
if (source != null) {
resolver.release(source);
}
}
} finally {
EnvironmentHelper.leaveProcessor();
env.finishingProcessing();
if (manager != null) {
manager.release(processor);
}
}
}