CPD Results

The following document contains the results of PMD's CPD 7.14.0.

Duplications

File Line
org/forgerock/doc/maven/build/HtmlForBootstrap.java 127
org/forgerock/doc/maven/build/Xhtml5.java 127
ImageCopier.copyImages("bootstrap", "", m);
            } catch (IOException e) {
                throw new MojoExecutionException("Failed to copy images", e);
            }

            ArrayList<Element> cfg = new ArrayList<Element>();
            cfg.add(element(name("chunkedOutput"), "false"));
            cfg.add(element(name("highlightSource"), m.useSyntaxHighlighting()));
            cfg.add(element(name("includes"), "*/" + m.getDocumentSrcName()));
            cfg.add(element(name("sectionAutolabel"), m.areSectionsAutolabeled()));
            cfg.add(element(name("sectionLabelIncludesComponentLabel"), m.doesSectionLabelIncludeComponentLabel()));
            cfg.add(element(name("sourceDirectory"), m.path(m.getDocbkxModifiableSourcesDirectory())));
            cfg.add(element(name("targetDatabaseDocument"), getTargetDB()));
            cfg.add(element(name("targetDirectory"), m.path(m.getDocbkxOutputDirectory()) + "/bootstrap"));
File Line
org/forgerock/doc/maven/build/HtmlForBootstrap.java 76
org/forgerock/doc/maven/build/Xhtml5.java 76
OLinkUtils.createTargetDatabase(targetDB, "bootstrap", m);
        } catch (Exception e) {
            throw new MojoExecutionException(
                    "Failed to write link target database: " + targetDB.getPath(), e);
        }

        return targetDB.getPath();
    }

    /**
     * Enclose methods to run plugins.
     */
    class Executor extends MojoExecutor {

        /**
         * Prepare olink target database from DocBook XML sources.
         *
         * @throws MojoExecutionException Failed to build target database.
         */
        void prepareOlinkDB() throws MojoExecutionException {

            for (String docName : m.getDocNames()) {
                ArrayList<Element> cfg = new ArrayList<Element>();
                cfg.add(element(name("chunkedOutput"), "false"));
                cfg.add(element(name("collectXrefTargets"), "only"));
                cfg.add(element(name("includes"), docName + "/" + m.getDocumentSrcName()));
                cfg.add(element(name("sourceDirectory"), m.path(m.getDocbkxModifiableSourcesDirectory())));
                cfg.add(element(name("htmlCustomization"), m.path(m.getBootstrapCustomization())));
File Line
org/forgerock/doc/maven/build/ChunkedHtml.java 77
org/forgerock/doc/maven/build/SingleHtml.java 76
OLinkUtils.createTargetDatabase(targetDB, "html", m, true);
        } catch (Exception e) {
            throw new MojoExecutionException(
                    "Failed to write link target database: " + targetDB.getPath(), e);
        }

        return targetDB.getPath();
    }

    /**
     * Enclose methods to run plugins.
     */
    class Executor extends MojoExecutor {

        /**
         * Prepare olink target database from DocBook XML sources.
         *
         * @throws MojoExecutionException Failed to build target database.
         */
        void prepareOlinkDB() throws MojoExecutionException {

            for (String docName : m.getDocNames()) {
                ArrayList<Element> cfg = new ArrayList<MojoExecutor.Element>();
                cfg.add(element(name("xincludeSupported"), m.isXincludeSupported()));
                cfg.add(element(name("sourceDirectory"), m.path(m.getDocbkxModifiableSourcesDirectory())));
                cfg.add(element(name("chunkedOutput"), "true"));
File Line
org/forgerock/doc/maven/release/Layout.java 41
org/forgerock/doc/maven/site/Layout.java 37
public class Layout {

    /**
     * The Mojo that holds configuration and related methods.
     */
    private AbstractDocbkxMojo m;

    /**
     * The Executor to run the resources plugin.
     */
    private final Executor executor;

    /**
     * Constructor setting the Mojo that holds the configuration.
     *
     * @param mojo The Mojo that holds the configuration.
     */
    public Layout(final AbstractDocbkxMojo mojo) {
        m = mojo;
        this.executor = new Executor();
    }

    /**
     * Lay out built documents.
     *
     * @throws MojoExecutionException Failed to layout site.
     */
    public void execute() throws MojoExecutionException {
        executor.layout();
    }

    /**
     * Get element specifying built documents to copy to the release directory.
     *
     * <p>
     *
     * Currently only HTML and PDF are released.
     *
     * @return Compound element specifying built documents to copy.
     * @throws MojoExecutionException Something went wrong getting document names.
     */
    private MojoExecutor.Element getResources() throws MojoExecutionException {

        ArrayList<MojoExecutor.Element> r = new ArrayList<MojoExecutor.Element>();
        final List<Format> formats = m.getFormats();
        final String outputDir = m.path(m.getDocbkxOutputDirectory());

        if (formats.contains(Format.html)) {
File Line
org/forgerock/doc/maven/build/HtmlForBootstrap.java 105
org/forgerock/doc/maven/build/SingleHtml.java 106
cfg.add(element(name("targetDirectory"), m.path(m.getDocbkxOutputDirectory()) + "/bootstrap"));
                cfg.add(element(name("targetsFilename"), m.getDocumentSrcName() + ".html.target.db"));

                executeMojo(
                        plugin(
                                groupId("com.agilejava.docbkx"),
                                artifactId("docbkx-maven-plugin"),
                                version(m.getDocbkxVersion())),
                        goal("generate-html"),
                        configuration(cfg.toArray(new Element[cfg.size()])),
                        executionEnvironment(m.getProject(), m.getSession(), m.getPluginManager()));
            }
        }

        /**
         * Build documents from DocBook XML sources.
         *
         * @throws MojoExecutionException Failed to build the output.
         */
        void build() throws MojoExecutionException {

            try {
                ImageCopier.copyImages("bootstrap", "", m);