001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2012-2014 ForgeRock AS 015 */ 016 017package org.forgerock.doc.maven.pre; 018 019import org.apache.maven.plugin.MojoExecutionException; 020import org.forgerock.doc.maven.AbstractDocbkxMojo; 021import org.forgerock.doc.maven.utils.HtmlUtils; 022 023import java.io.IOException; 024 025/** 026 * Add custom CSS for the normal, non-release build. 027 */ 028public class CustomCss { 029 030 /** 031 * The Mojo that holds configuration and related methods. 032 */ 033 private AbstractDocbkxMojo m; 034 035 /** 036 * Constructor setting the Mojo that holds the configuration. 037 * 038 * @param mojo The Mojo that holds the configuration. 039 */ 040 public CustomCss(final AbstractDocbkxMojo mojo) { 041 m = mojo; 042 } 043 044 /** 045 * Add custom CSS to the modifiable copy of DocBook XML sources. 046 * 047 * @throws MojoExecutionException Failed to add CSS. 048 */ 049 public void execute() throws MojoExecutionException { 050 try { 051 HtmlUtils.addCustomCss( 052 m.getPreSiteCss(), 053 m.getDocbkxModifiableSourcesDirectory(), 054 m.getDocumentSrcName()); 055 } catch (IOException e) { 056 throw new MojoExecutionException(e.getMessage(), e); 057 } 058 } 059}