}
@Override
public ResponseContent handleRequest(ParsedContentPath contentPath, BundleSet bundleSet, UrlContentAccessor contentAccessor, String version) throws ContentProcessingException {
BundlableNode bundlableNode = bundleSet.getBundlableNode();
String theme = contentPath.properties.get("theme");
String resourcePath = contentPath.properties.get("resourcePath");
File resourceFile = null;
if (contentPath.formName.equals(ASPECT_THEME_REQUEST))
{
String aspectName = contentPath.properties.get("aspect");
Aspect aspect = bundlableNode.app().aspect(aspectName);
List<ResourcesAssetLocation> resourceAssetLocations = getResourceAssetLocations(aspect);
for (ResourcesAssetLocation location : resourceAssetLocations) {
if (location.getThemeName().equals(theme)){
resourceFile = location.file(resourcePath);
}
}
}
else if (contentPath.formName.equals(ASPECT_RESOURCE_REQUEST))
{
String aspectName = contentPath.properties.get("aspect");
Aspect aspect = bundlableNode.app().aspect(aspectName);
resourceFile = aspect.file(resourcePath);
}
else if (contentPath.formName.equals(BLADESET_THEME_REQUEST))
{
Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
ThemedAssetLocation location = getThemedResourceLocation(bladeset, theme);
resourceFile = location.file(resourcePath);
}
else if (contentPath.formName.equals(BLADESET_RESOURCE_REQUEST))
{
Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
resourceFile = bladeset.file(resourcePath);
}
else if (contentPath.formName.equals(BLADE_THEME_REQUEST))
{
Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
Blade blade = bladeset.blade(contentPath.properties.get("blade"));
ThemedAssetLocation location = getThemedResourceLocation(blade, theme);
resourceFile = location.file(resourcePath);
}
else if (contentPath.formName.equals(BLADE_RESOURCE_REQUEST))
{
Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
Blade blade = bladeset.blade(contentPath.properties.get("blade"));
resourceFile = blade.file(resourcePath);
}
else if (contentPath.formName.equals(WORKBENCH_THEME_REQUEST))
{
//TODO: this needs implementing
// Workbenches dont have themes ?
}
else if (contentPath.formName.equals(WORKBENCH_RESOURCE_REQUEST))
{
Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
Blade blade = bladeset.blade(contentPath.properties.get("blade"));
Workbench workbench = blade.workbench();
resourceFile = workbench.file(resourcePath);
}
else if (contentPath.formName.equals(LIB_REQUEST))
{
JsLib jsLib = bundlableNode.app().jsLib(contentPath.properties.get("lib"));
resourceFile = jsLib.file(resourcePath);
}
else
{
throw new ContentProcessingException("Cannot handle request with form name " + contentPath.formName);