in doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java [714:766]
public SiteRenderingContext createContextForSkin(
Artifact skin, Map<String, ?> attributes, SiteModel siteModel, String defaultTitle, Locale locale)
throws IOException, RendererException {
SiteRenderingContext context = createSiteRenderingContext(attributes, siteModel, defaultTitle, locale);
context.setSkin(skin);
ZipFile zipFile = getZipFile(skin.getFile());
InputStream in = null;
try {
if (zipFile.getEntry(SKIN_TEMPLATE_LOCATION) == null) {
throw new RendererException("Skin does not contain template at " + SKIN_TEMPLATE_LOCATION);
}
context.setTemplateName(SKIN_TEMPLATE_LOCATION);
context.setTemplateClassLoader(
new URLClassLoader(new URL[] {skin.getFile().toURI().toURL()}));
ZipEntry skinDescriptorEntry = zipFile.getEntry(SkinModel.SKIN_DESCRIPTOR_LOCATION);
if (skinDescriptorEntry != null) {
in = zipFile.getInputStream(skinDescriptorEntry);
SkinModel skinModel = new SkinXpp3Reader().read(in);
context.setSkinModel(skinModel);
String toolsPrerequisite = skinModel.getPrerequisites() == null
? null
: skinModel.getPrerequisites().getDoxiaSitetools();
Package p = DefaultSiteRenderer.class.getPackage();
String current = (p == null) ? null : p.getImplementationVersion();
if (StringUtils.isNotBlank(toolsPrerequisite)
&& (current != null)
&& !matchVersion(current, toolsPrerequisite)) {
throw new RendererException("Your current Doxia Sitetools version " + current
+ " does not match the requirements of the skin (" + toolsPrerequisite
+ "). In order to fix this choose a skin version that is "
+ "compatible with this Doxia Sitetools version.");
}
}
} catch (XmlPullParserException e) {
throw new RendererException(
"Failed to parse " + SkinModel.SKIN_DESCRIPTOR_LOCATION + " skin descriptor from " + skin.getId()
+ " skin",
e);
} finally {
IOUtil.close(in);
closeZipFile(zipFile);
}
return context;
}