Validate.notNull(templateProcessingParameters, "Template Processing Parameters cannot be null");
final IContext context = templateProcessingParameters.getContext();
if (context instanceof SlingContext) {
final SlingContext slingContext = (SlingContext) context;
final ResourceResolver resourceResolver = slingContext.getResourceResolver();
final Resource resource = resourceResolver.getResource(resourceName);
return resource.adaptTo(InputStream.class);
} else {
throw new TemplateProcessingException("Cannot handle context: " + context.getClass().getName());
}