maven-doxia-tools-1.2.1/0000755000175000017500000000000011633744576015037 5ustar twernertwernermaven-doxia-tools-1.2.1/pom.xml0000644000175000017500000001374411377556202016355 0ustar twernertwerner 4.0.0 org.apache.maven.shared maven-shared-components 15 org.apache.maven.shared maven-doxia-tools 1.2.1 Maven Doxia Integration Tools A collection of tools to help the integration of Doxia in Maven plugins. 2.0.6 scm:svn:http://svn.apache.org/repos/asf/maven/shared/tags/maven-doxia-tools-1.2.1 scm:svn:https://svn.apache.org/repos/asf/maven/shared/tags/maven-doxia-tools-1.2.1 http://svn.apache.org/viewvc/maven/shared/tags/maven-doxia-tools-1.2.1 jira http://jira.codehaus.org/browse/MSHARED 1.1.3 1.1.3 2.0.6 commons-io commons-io 1.4 org.apache.maven maven-artifact ${mavenVersion} org.apache.maven maven-artifact-manager ${mavenVersion} org.apache.maven maven-model ${mavenVersion} org.apache.maven maven-project ${mavenVersion} org.apache.maven.reporting maven-reporting-api ${mavenVersion} org.apache.maven maven-plugin-api ${mavenVersion} org.apache.maven.doxia doxia-logging-api ${doxiaVersion} org.apache.maven.doxia doxia-decoration-model ${doxiaSitetoolsVersion} org.codehaus.plexus plexus-container-default 1.0-alpha-9 org.codehaus.plexus plexus-i18n 1.0-beta-7 org.codehaus.plexus plexus-component-api org.codehaus.plexus plexus-utils 1.4.5 org.apache.maven.shared maven-plugin-testing-harness 1.0 test org.codehaus.plexus plexus-maven-plugin create-component-descriptor descriptor org.codehaus.mojo l10n-maven-plugin 1.0-alpha-2 ca cs da de es fr hu it ja ko lt nl no pl pt pt_BR sk sv tr zh_CN zh_TW maven-doxia-tools-1.2.1/src/0000755000175000017500000000000011633744576015626 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/0000755000175000017500000000000011633744576016605 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/0000755000175000017500000000000011633744576020617 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/0000755000175000017500000000000011633744576021576 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/no-site-test/0000755000175000017500000000000011633744576024131 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/no-site-test/pom.xml0000644000175000017500000000262411152230410025417 0ustar twernertwerner 4.0.0 org.apache.maven.shared no-site-test 1.0-SNAPSHOT jar dummy junit junit 3.8.2 test maven-doxia-tools-1.2.1/src/test/resources/unit/site-tool-test/0000755000175000017500000000000011633744576024472 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/site-tool-test/pom.xml0000644000175000017500000000262611152230410025762 0ustar twernertwerner 4.0.0 org.apache.maven.shared site-tool-test 1.0-SNAPSHOT jar dummy junit junit 3.8.1 test maven-doxia-tools-1.2.1/src/test/resources/unit/site-tool-test/src/0000755000175000017500000000000011633744576025261 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/site-tool-test/src/site/0000755000175000017500000000000011633744576026225 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/resources/unit/site-tool-test/src/site/site.xml0000644000175000017500000000264511020006575027676 0ustar twernertwerner Maven Site http://maven.apache.org/images/apache-maven-project.png http://maven.apache.org/ http://maven.apache.org/images/maven-small.gif org.apache.maven.skins maven-stylus-skin ${reports} maven-doxia-tools-1.2.1/src/test/java/0000755000175000017500000000000011633744576017526 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/0000755000175000017500000000000011633744576020315 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/apache/0000755000175000017500000000000011633744576021536 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/0000755000175000017500000000000011633744576022644 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/0000755000175000017500000000000011633744576023750 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/0000755000175000017500000000000011633744576025110 5ustar twernertwernermaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/stubs/0000755000175000017500000000000011633744576026250 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.javamaven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.ja0000644000175000017500000000764211022460222033462 0ustar twernertwernerpackage org.apache.maven.doxia.tools.stubs; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.model.Build; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; /** * @author Vincent Siveton * @version $Id: SiteToolMavenProjectStub.java 664309 2008-06-07 10:18:58Z bentmann $ */ public class SiteToolMavenProjectStub extends MavenProjectStub { private Build build; private File basedir; public SiteToolMavenProjectStub( String projectName ) { basedir = new File( super.getBasedir() + "/src/test/resources/unit/" + projectName ); MavenXpp3Reader pomReader = new MavenXpp3Reader(); Model model = null; try { model = pomReader.read( new FileReader( new File( getBasedir(), "pom.xml" ) ) ); setModel( model ); } catch ( Exception e ) { throw new RuntimeException( e ); } setGroupId( model.getGroupId() ); setArtifactId( model.getArtifactId() ); setVersion( model.getVersion() ); setName( model.getName() ); setUrl( model.getUrl() ); setPackaging( model.getPackaging() ); build = new Build(); build.setFinalName( model.getArtifactId() ); build.setDirectory( super.getBasedir() + "/target/test/unit/" + projectName + "/target" ); build.setSourceDirectory( getBasedir() + "/src/main/java" ); build.setOutputDirectory( build.getDirectory() + "/classes" ); build.setTestSourceDirectory( getBasedir() + "/src/test/java" ); build.setTestOutputDirectory( build.getDirectory() + "/test-classes" ); List compileSourceRoots = new ArrayList(); compileSourceRoots.add( getBasedir() + "/src/main/java" ); setCompileSourceRoots( compileSourceRoots ); List testCompileSourceRoots = new ArrayList(); testCompileSourceRoots.add( getBasedir() + "/src/test/java" ); setTestCompileSourceRoots( testCompileSourceRoots ); } /** {@inheritDoc} */ public Build getBuild() { return build; } /** {@inheritDoc} */ public void setBuild( Build build ) { this.build = build; } /** {@inheritDoc} */ public File getBasedir() { return basedir; } public void setBasedir( File basedir ) { this.basedir = basedir; } /** {@inheritDoc} */ public List getRemoteArtifactRepositories() { ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2", new DefaultRepositoryLayout() ); return Collections.singletonList( repository ); } } maven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java0000644000175000017500000003000611022460222030323 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Locale; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.doxia.site.decoration.DecorationModel; import org.apache.maven.doxia.site.decoration.Skin; import org.apache.maven.doxia.tools.stubs.SiteToolMavenProjectStub; import org.codehaus.plexus.PlexusTestCase; /** * @author Vincent Siveton * @version $Id: SiteToolTest.java 664309 2008-06-07 10:18:58Z bentmann $ */ public class SiteToolTest extends PlexusTestCase { /** {@inheritDoc} */ protected void setUp() throws Exception { super.setUp(); } /** {@inheritDoc} */ protected void tearDown() throws Exception { super.tearDown(); } /** * @throws Exception */ protected ArtifactRepository getLocalRepo() throws Exception { String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS; String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN; ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag ); ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag ); ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); ArtifactRepositoryLayout defaultArtifactRepositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); return artifactRepositoryFactory.createArtifactRepository( "local", getTestFile( "target/local-repo" ).toURL() .toString(), defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy ); } /** * @throws Exception */ protected File getLocalRepoDir() throws Exception { return new File( getLocalRepo().getBasedir() ); } /** * @throws Exception */ public void testGetDefaultSkinArtifact() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "site-tool-test" ); assertNotNull( tool.getDefaultSkinArtifact( getLocalRepo(), project.getRemoteArtifactRepositories() ) ); } /** * @throws Exception */ public void testGetSkinArtifactFromRepository() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "site-tool-test" ); DecorationModel decorationModel = new DecorationModel(); Skin skin = new Skin(); skin.setGroupId( "org.apache.maven.skins" ); skin.setArtifactId( "maven-stylus-skin" ); decorationModel.setSkin( skin ); assertNotNull( tool.getSkinArtifactFromRepository( getLocalRepo(), project.getRemoteArtifactRepositories(), decorationModel ) ); } /** * @throws Exception */ public void testGetRelativePath() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); String to = "http://maven.apache.org"; String from = "http://maven.apache.org"; assertEquals( tool.getRelativePath( to, from ), "" ); to = "http://maven.apache.org/"; from = "http://maven.apache.org/plugins/maven-site-plugin"; assertEquals( tool.getRelativePath( to, from ), ".." + File.separator + ".." ); to = "http://maven.apache.org"; from = "http://maven.apache.org/plugins/maven-site-plugin/"; assertEquals( tool.getRelativePath( to, from ), ".." + File.separator + ".." ); to = "http://maven.apache.org/"; from = "http://maven.apache.org/plugins/maven-site-plugin/"; assertEquals( tool.getRelativePath( to, from ), ".." + File.separator + ".." ); to = "http://maven.apache.org"; from = "http://maven.apache.org/plugins/maven-site-plugin"; assertEquals( tool.getRelativePath( to, from ), ".." + File.separator + ".." ); to = "http://maven.apache.org/plugins/maven-site-plugin/"; from = "http://maven.apache.org"; assertEquals( tool.getRelativePath( to, from ), "plugins" + File.separator + "maven-site-plugin" ); to = "http://maven.apache.org/plugins/maven-site-plugin/"; from = "http://maven.apache.org/"; assertEquals( tool.getRelativePath( to, from ), "plugins" + File.separator + "maven-site-plugin" ); to = "http://maven.apache.org/plugins/maven-site-plugin"; from = "http://maven.apache.org"; assertEquals( tool.getRelativePath( to, from ), "plugins" + File.separator + "maven-site-plugin" ); to = "http://maven.apache.org/plugins/maven-site-plugin"; from = "http://maven.apache.org/"; assertEquals( tool.getRelativePath( to, from ), "plugins" + File.separator + "maven-site-plugin" ); // Tests between files as described in MIDEA-102 to = "C:/dev/voca/gateway/parser/gateway-parser.iml"; from = "C:/dev/voca/gateway/"; assertEquals( "Child file using Windows drive letter", "parser" + File.separator + "gateway-parser.iml", tool.getRelativePath( to, from ) ); to = "C:/foo/child"; from = "C:/foo/master"; assertEquals( "Sibling directory using Windows drive letter", ".." + File.separator + "child", tool.getRelativePath( to, from ) ); to = "/myproject/myproject-module1"; from = "/myproject/myproject"; assertEquals( "Sibling directory with similar name", ".." + File.separator + "myproject-module1", tool.getRelativePath( to, from ) ); // Normalized paths as described in MSITE-284 assertEquals( ".." + File.separator + "project-module-1" + File.separator + "src" + File.separator + "site", tool.getRelativePath( "Z:\\dir\\project\\project-module-1\\src\\site", "Z:\\dir\\project\\project-module-1\\..\\project-parent" ) ); assertEquals( ".." + File.separator + ".." + File.separator + ".." + File.separator + "project-parent", tool.getRelativePath( "Z:\\dir\\project\\project-module-1\\..\\project-parent", "Z:\\dir\\project\\project-module-1\\src\\site" ) ); assertEquals( ".." + File.separator + "foo", tool.getRelativePath( "../../foo/foo", "../../foo/bar" ) ); } /** * @throws Exception */ public void testGetSiteDescriptorFromBasedir() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "site-tool-test" ); assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), null ).toString(), project.getBasedir() + File.separator + "src" + File.separator + "site" + File.separator + "site.xml" ); assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), Locale.ENGLISH ).toString(), project.getBasedir() + File.separator + "src" + File.separator + "site" + File.separator + "site.xml" ); String siteDir = "src/blabla"; assertEquals( tool.getSiteDescriptorFromBasedir( siteDir, project.getBasedir(), null ).toString(), project.getBasedir() + File.separator + "src" + File.separator + "blabla" + File.separator + "site.xml" ); } /** * @throws Exception */ public void testGetSiteDescriptorFromRepository() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "site-tool-test" ); project.setGroupId( "org.apache.maven" ); project.setArtifactId( "maven-site" ); project.setVersion( "1.0" ); String result = getLocalRepoDir() + File.separator + "org" + File.separator + "apache" + File.separator + "maven" + File.separator + "maven-site" + File.separator + "1.0" + File.separator + "maven-site-1.0-site.xml"; assertEquals( tool.getSiteDescriptorFromRepository( project, getLocalRepo(), project.getRemoteArtifactRepositories(), Locale.ENGLISH ) .toString(), result ); } /** * @throws Exception */ public void testGetDecorationModel() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "site-tool-test" ); project.setGroupId( "org.apache.maven" ); project.setArtifactId( "maven-site" ); project.setVersion( "1.0" ); String siteDirectory = "src/site"; List reactorProjects = new ArrayList(); project.setBasedir( null ); // get it from repo DecorationModel model = tool.getDecorationModel( project, reactorProjects, getLocalRepo(), project .getRemoteArtifactRepositories(), siteDirectory, Locale.getDefault(), "ISO-8859-1", "ISO-8859-1" ); assertNotNull( model ); assertNotNull( model.getBannerLeft() ); assertEquals( "Maven", model.getBannerLeft().getName() ); assertEquals( "images/apache-maven-project-2.png", model.getBannerLeft().getSrc() ); assertEquals( "http://maven.apache.org/", model.getBannerLeft().getHref() ); assertNotNull( model.getBannerRight() ); assertNull( model.getBannerRight().getName() ); assertEquals( "images/maven-logo-2.gif", model.getBannerRight().getSrc() ); assertNull( model.getBannerRight().getHref() ); } /** * @throws Exception */ public void testGetDefaultDecorationModel() throws Exception { SiteTool tool = (SiteTool) lookup( SiteTool.ROLE ); assertNotNull( tool ); SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "no-site-test" ); String siteDirectory = "src/site"; List reactorProjects = new ArrayList(); DecorationModel model = tool.getDecorationModel( project, reactorProjects, getLocalRepo(), project.getRemoteArtifactRepositories(), siteDirectory, Locale.getDefault(), "UTF-8", "UTF-8" ); assertNotNull( model ); } } maven-doxia-tools-1.2.1/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java0000644000175000017500000000431211005075354031642 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import junit.framework.TestCase; /** * @author Vincent Siveton * @version $Id: DefaultSiteToolTest.java 651940 2008-04-27 13:09:00Z vsiveton $ */ public class DefaultSiteToolTest extends TestCase { /** {@inheritDoc} */ protected void setUp() throws Exception { super.setUp(); } /** {@inheritDoc} */ protected void tearDown() throws Exception { super.tearDown(); } /** * @throws Exception */ public void testGetNormalizedPath() throws Exception { assertEquals( null, DefaultSiteTool.getNormalizedPath( null ) ); assertEquals( "", DefaultSiteTool.getNormalizedPath( "" ) ); assertEquals( "foo", DefaultSiteTool.getNormalizedPath( "foo" ) ); assertEquals( "foo/bar", DefaultSiteTool.getNormalizedPath( "foo/bar" ) ); assertEquals( "foo/bar", DefaultSiteTool.getNormalizedPath( "foo\\bar" ) ); assertEquals( "foo/bar", DefaultSiteTool.getNormalizedPath( "foo/./bar" ) ); assertEquals( "bar", DefaultSiteTool.getNormalizedPath( "foo/../bar" ) ); assertEquals( "foo", DefaultSiteTool.getNormalizedPath( "./foo" ) ); assertEquals( "../foo", DefaultSiteTool.getNormalizedPath( "../foo" ) ); assertEquals( "../../foo", DefaultSiteTool.getNormalizedPath( "../../foo" ) ); } } maven-doxia-tools-1.2.1/src/site/0000755000175000017500000000000011633744576016572 5ustar twernertwernermaven-doxia-tools-1.2.1/src/site/apt/0000755000175000017500000000000011633744576017356 5ustar twernertwernermaven-doxia-tools-1.2.1/src/site/apt/index.apt0000644000175000017500000000256111020006575021153 0ustar twernertwerner ------ Introduction ------ Dennis Lundberg ------ 2008-04-27 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Maven Doxia Tools This shared component has some utilities that are useful when integrating Doxia in Maven, mainly for site generation and report creation. The main entry point is the {{{apidocs/org/apache/maven/doxia/tools/SiteTool.html}SiteTool}} Plexus component. * Usage Instructions on how to use the integration of Doxia in Maven can be found {{{usage.html}here}}. maven-doxia-tools-1.2.1/src/site/apt/usage.apt0000644000175000017500000000321211005077274021151 0ustar twernertwerner ------ Usage ------ Dennis Lundberg Vincent Siveton ------ 2008-04-27 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Using the SiteTool in a Mojo +----- ... import org.apache.maven.doxia.tools.SiteTool; ... /** * Your own mojo. */ public class YourOwnMojo extends AbstractMojo { ... /** * SiteTool. * * @component */ protected SiteTool siteTool; ... public someMethod() { List localesList = siteTool.getAvailableLocales( locales ); String relativePath = siteTool.getRelativePath( "C:/foo/child", "C:/foo/master" ); ... } ... } +----- * References [[1]] {{{apidocs/org/apache/maven/doxia/tools/SiteTool.html}SiteTool API}} []maven-doxia-tools-1.2.1/src/site/site.xml0000644000175000017500000000231511252711123020234 0ustar twernertwerner maven-doxia-tools-1.2.1/src/main/0000755000175000017500000000000011633744576016552 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/resources/0000755000175000017500000000000011633744576020564 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/resources/site-tool_cs.properties0000644000175000017500000000212611020006575025263 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Nad\u0159azen\u00fd projekt decorationModel.menu.projectdocumentation = Dokumentace projektu decorationModel.menu.projectinformation = Informace o projektu decorationModel.menu.projectmodules = Moduly decorationModel.menu.projectreports = Souhrny projektu maven-doxia-tools-1.2.1/src/main/resources/site-tool_sv.properties0000644000175000017500000000212211033525423025304 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = F\u00f6r\u00e4ldraprojekt decorationModel.menu.projectdocumentation = Projektdokumentation decorationModel.menu.projectinformation = Projektinformation decorationModel.menu.projectmodules = Moduler decorationModel.menu.projectreports = Projektrapportermaven-doxia-tools-1.2.1/src/main/resources/site-tool_ja.properties0000644000175000017500000000234111020006575025247 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = \u89aa\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 decorationModel.menu.projectdocumentation = \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u6587\u66f8 decorationModel.menu.projectinformation = \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u60c5\u5831 decorationModel.menu.projectmodules = \u30e2\u30b8\u30e5\u30fc\u30eb decorationModel.menu.projectreports = \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30ec\u30dd\u30fc\u30c8 maven-doxia-tools-1.2.1/src/main/resources/site-tool_pt.properties0000644000175000017500000000215711060457365025320 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Projecto Pai decorationModel.menu.projectdocumentation = Documenta\u00e7\u00e3o do Projeto decorationModel.menu.projectinformation = Informa\u00e7\u00e3o do Projeto decorationModel.menu.projectmodules = M\u00f3dulos decorationModel.menu.projectreports = Relat\u00f3rios do Projeto maven-doxia-tools-1.2.1/src/main/resources/site-tool_pt_BR.properties0000644000175000017500000000216311020006575025665 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Projeto Pai decorationModel.menu.projectdocumentation = Documenta\u00e7\u00e3o do Projeto decorationModel.menu.projectinformation = Informa\u00e7\u00f5es sobre o Projeto decorationModel.menu.projectmodules = M\u00f3dulo decorationModel.menu.projectreports = Relat\u00f3rios do Projeto maven-doxia-tools-1.2.1/src/main/resources/default-site.xml0000644000175000017500000000212310747102534023655 0ustar twernertwerner ${project.name} maven-doxia-tools-1.2.1/src/main/resources/site-tool_sk.properties0000644000175000017500000000215311020006575025273 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Nadraden\u00fd projekt decorationModel.menu.projectdocumentation = Projektov\u00e1 dokument\u00e1cia decorationModel.menu.projectinformation = Inform\u00e1cie o projekte decorationModel.menu.projectmodules = Moduly decorationModel.menu.projectreports = Projektov\u00e9 zostavy maven-doxia-tools-1.2.1/src/main/resources/site-tool_no.properties0000644000175000017500000000211511020006575025270 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Hovedprosjekt decorationModel.menu.projectdocumentation = Prosjekt dokumentasjon decorationModel.menu.projectinformation = Prosjekt informasjon decorationModel.menu.projectmodules = Moduler decorationModel.menu.projectreports = Prosjekt rapporter maven-doxia-tools-1.2.1/src/main/resources/site-tool_fr.properties0000644000175000017500000000210611020006575025263 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Projet parent decorationModel.menu.projectdocumentation = Documentation sur le projet decorationModel.menu.projectinformation = Info Projet decorationModel.menu.projectmodules = Modules decorationModel.menu.projectreports = Rapports Projet maven-doxia-tools-1.2.1/src/main/resources/site-tool_en.properties0000644000175000017500000000227511020006575025265 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # NOTE: # This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It # must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the # JVM's default locale (which need not be "en"). See the method javadoc about # ResourceBundle.getBundle(String, Locale, ClassLoader) # for a full description of the lookup strategy. maven-doxia-tools-1.2.1/src/main/resources/site-tool_pl.properties0000644000175000017500000000213111020006575025265 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Projekt nadrz\u0119dny decorationModel.menu.projectdocumentation = Dokumentacja projektu decorationModel.menu.projectinformation = Informacja o projekcie decorationModel.menu.projectmodules = Modu\u0142y decorationModel.menu.projectreports = Raporty projektu maven-doxia-tools-1.2.1/src/main/resources/site-tool_tr.properties0000644000175000017500000000211711033525423025305 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Ana Proje decorationModel.menu.projectdocumentation = Proje Dok\u00fcmantasyonu decorationModel.menu.projectinformation = Proje Bilgileri decorationModel.menu.projectmodules = Mod\u00fcller decorationModel.menu.projectreports = Proje Raporlar\u00fd maven-doxia-tools-1.2.1/src/main/resources/site-tool_ko.properties0000644000175000017500000000225111020006575025266 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = \ubd80\ubaa8 \ud504\ub85c\uc81d\ud2b8 decorationModel.menu.projectdocumentation = \ud504\ub85c\uc81d\ud2b8 \ubb38\uc11c\ud654 decorationModel.menu.projectinformation = \ud504\ub85c\uc81d\ud2b8 \uc815\ubcf4 decorationModel.menu.projectmodules = \ubaa8\ub4c8 decorationModel.menu.projectreports = \ud504\ub85c\uc81d\ud2b8 \ubcf4\uace0\uc11c maven-doxia-tools-1.2.1/src/main/resources/site-tool_hu.properties0000644000175000017500000000214511020006575025273 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Sz\u00fcl\u0151 projekt decorationModel.menu.projectdocumentation = Projekt dokument\u00e1ci\u00f3 decorationModel.menu.projectinformation = Projekt inform\u00e1ci\u00f3 decorationModel.menu.projectmodules = Modulok decorationModel.menu.projectreports = Projekt riportok maven-doxia-tools-1.2.1/src/main/resources/site-tool_nl.properties0000644000175000017500000000211411020006575025264 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Bevattend project decorationModel.menu.projectdocumentation = Project documentatie decorationModel.menu.projectinformation = Project informatie decorationModel.menu.projectmodules = Modulen decorationModel.menu.projectreports = Project rapporten maven-doxia-tools-1.2.1/src/main/resources/site-tool_zh_TW.properties0000644000175000017500000000227611143653364025731 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = \u7236\u5c08\u6848 (Parent Project) decorationModel.menu.projectdocumentation = \u5c08\u6848\u6587\u4ef6 (Project Documentation) decorationModel.menu.projectinformation = \u5c08\u6848\u8cc7\u8a0a (Project Information) decorationModel.menu.projectmodules = \u6a21\u7d44 (Modules) decorationModel.menu.projectreports = \u5c08\u6848\u5831\u8868 (Project Reports) maven-doxia-tools-1.2.1/src/main/resources/site-tool_ca.properties0000644000175000017500000000214411033525423025243 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Projecte pare decorationModel.menu.projectdocumentation = Documentaci\u00f3 del projecte decorationModel.menu.projectinformation = Informaci\u00f3 del projecte decorationModel.menu.projectmodules = M\u00f2duls decorationModel.menu.projectreports = Informes del projecte maven-doxia-tools-1.2.1/src/main/resources/site-tool_it.properties0000644000175000017500000000213211020006575025267 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Progetto Padre decorationModel.menu.projectdocumentation = Documentazione del Progetto decorationModel.menu.projectinformation = Informazioni sul Progetto decorationModel.menu.projectmodules = Moduli decorationModel.menu.projectreports = Rapporti del Progetto maven-doxia-tools-1.2.1/src/main/resources/site-tool_da.properties0000644000175000017500000000211611042310402025230 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Overordnet Projekt decorationModel.menu.projectdocumentation = Projekt Dokumentation decorationModel.menu.projectinformation = Projekt Information decorationModel.menu.projectmodules = Moduler decorationModel.menu.projectreports = Projekt Rapportermaven-doxia-tools-1.2.1/src/main/resources/site-tool.properties0000644000175000017500000000211011020006575024567 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Parent Project decorationModel.menu.projectdocumentation = Project Documentation decorationModel.menu.projectinformation = Project Information decorationModel.menu.projectmodules = Modules decorationModel.menu.projectreports = Project Reportsmaven-doxia-tools-1.2.1/src/main/resources/site-tool_de.properties0000644000175000017500000000212511020006575025245 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = \u00fcbergeordnetes Projekt decorationModel.menu.projectdocumentation = Projektdokumentation decorationModel.menu.projectinformation = Projektinformationen decorationModel.menu.projectmodules = Module decorationModel.menu.projectreports = Projektberichte maven-doxia-tools-1.2.1/src/main/resources/site-tool_zh_CN.properties0000644000175000017500000000214311020006575025656 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = \u7236\u9879\u76ee decorationModel.menu.projectdocumentation = \u9879\u76ee\u6587\u6863 decorationModel.menu.projectinformation = \u9879\u76ee\u4fe1\u606f decorationModel.menu.projectmodules = \u6a21\u5757 decorationModel.menu.projectreports = \u9879\u76ee\u62a5\u8868 maven-doxia-tools-1.2.1/src/main/resources/site-tool_es.properties0000644000175000017500000000215011020006575025262 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = Proyecto padre decorationModel.menu.projectdocumentation = Documentaci\u00f3n del proyecto decorationModel.menu.projectinformation = Informaci\u00f3n del proyecto decorationModel.menu.projectmodules = M\u00f3dulos decorationModel.menu.projectreports = Informes del proyecto maven-doxia-tools-1.2.1/src/main/resources/site-tool_lt.properties0000644000175000017500000000213511344744153025307 0ustar twernertwerner# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. decorationModel.menu.parentproject = T\u0117vinis projektas decorationModel.menu.projectdocumentation = Projekt\u0173 dokumentacija decorationModel.menu.projectinformation = Projekto informacija decorationModel.menu.projectmodules = Moduliai decorationModel.menu.projectreports = Projekto ataskaitos maven-doxia-tools-1.2.1/src/main/java/0000755000175000017500000000000011633744576017473 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/0000755000175000017500000000000011633744576020262 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/apache/0000755000175000017500000000000011633744576021503 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/apache/maven/0000755000175000017500000000000011633744576022611 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/0000755000175000017500000000000011633744576023715 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/0000755000175000017500000000000011633744576025055 5ustar twernertwernermaven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/MojoLogWrapper.java0000644000175000017500000000751011234112216030603 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.apache.maven.doxia.logging.Log; /** * Wrap a Mojo logger into a Doxia logger. * * @author Vincent Siveton * @version $Id: MojoLogWrapper.java 799000 2009-07-29 18:27:26Z ltheussl $ * @since 1.1 * @see org.apache.maven.plugin.logging.Log */ public class MojoLogWrapper implements Log { private final org.apache.maven.plugin.logging.Log mojoLog; /** * @param log a Mojo log */ public MojoLogWrapper( org.apache.maven.plugin.logging.Log log ) { this.mojoLog = log; } /** {@inheritDoc} */ public void setLogLevel( int level ) { // nop } /** {@inheritDoc} */ public void debug( CharSequence content ) { mojoLog.debug( toString( content ) ); } /** {@inheritDoc} */ public void debug( CharSequence content, Throwable error ) { mojoLog.debug( toString( content ), error ); } /** {@inheritDoc} */ public void debug( Throwable error ) { mojoLog.debug( "", error ); } /** {@inheritDoc} */ public void info( CharSequence content ) { mojoLog.info( toString( content ) ); } /** {@inheritDoc} */ public void info( CharSequence content, Throwable error ) { mojoLog.info( toString( content ), error ); } /** {@inheritDoc} */ public void info( Throwable error ) { mojoLog.info( "", error ); } /** {@inheritDoc} */ public void warn( CharSequence content ) { mojoLog.warn( toString( content ) ); } /** {@inheritDoc} */ public void warn( CharSequence content, Throwable error ) { mojoLog.warn( toString( content ), error ); } /** {@inheritDoc} */ public void warn( Throwable error ) { mojoLog.warn( "", error ); } /** {@inheritDoc} */ public void error( CharSequence content ) { mojoLog.error( toString( content ) ); } /** {@inheritDoc} */ public void error( CharSequence content, Throwable error ) { mojoLog.error( toString( content ), error ); } /** {@inheritDoc} */ public void error( Throwable error ) { mojoLog.error( "", error ); } /** {@inheritDoc} */ public boolean isDebugEnabled() { return mojoLog.isDebugEnabled(); } /** {@inheritDoc} */ public boolean isInfoEnabled() { return mojoLog.isInfoEnabled(); } /** {@inheritDoc} */ public boolean isWarnEnabled() { return mojoLog.isWarnEnabled(); } /** {@inheritDoc} */ public boolean isErrorEnabled() { return mojoLog.isErrorEnabled(); } // ---------------------------------------------------------------------- // Private methods // ---------------------------------------------------------------------- private String toString( CharSequence content ) { if ( content == null ) { return ""; } return content.toString(); } } maven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java0000644000175000017500000015300211344467361030761 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.apache.commons.io.FilenameUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.doxia.site.decoration.Banner; import org.apache.maven.doxia.site.decoration.DecorationModel; import org.apache.maven.doxia.site.decoration.Menu; import org.apache.maven.doxia.site.decoration.MenuItem; import org.apache.maven.doxia.site.decoration.Skin; import org.apache.maven.doxia.site.decoration.inheritance.DecorationModelInheritanceAssembler; import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader; import org.apache.maven.model.Model; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.reporting.MavenReport; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.interpolation.EnvarBasedValueSource; import org.codehaus.plexus.util.interpolation.MapBasedValueSource; import org.codehaus.plexus.util.interpolation.ObjectBasedValueSource; import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; /** * Default implementation of the site tool. * * @author Vincent Siveton * @version $Id: DefaultSiteTool.java 919780 2010-03-06 15:04:17Z hboutemy $ * * @plexus.component role="org.apache.maven.doxia.tools.SiteTool" role-hint="default" */ public class DefaultSiteTool extends AbstractLogEnabled implements SiteTool { // ---------------------------------------------------------------------- // Components // ---------------------------------------------------------------------- /** * The component that is used to resolve additional artifacts required. * * @plexus.requirement */ private ArtifactResolver artifactResolver; /** * The component used for creating artifact instances. * * @plexus.requirement */ private ArtifactFactory artifactFactory; /** * Internationalization. * * @plexus.requirement */ protected I18N i18n; /** * The component for assembling inheritance. * * @plexus.requirement */ protected DecorationModelInheritanceAssembler assembler; /** * Project builder. * * @plexus.requirement */ protected MavenProjectBuilder mavenProjectBuilder; // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- /** {@inheritDoc} */ public Artifact getSkinArtifactFromRepository( ArtifactRepository localRepository, List remoteArtifactRepositories, DecorationModel decoration ) throws SiteToolException { if ( localRepository == null ) { throw new IllegalArgumentException( "The parameter 'localRepository' can not be null" ); } if ( remoteArtifactRepositories == null ) { throw new IllegalArgumentException( "The parameter 'remoteArtifactRepositories' can not be null" ); } if ( decoration == null ) { throw new IllegalArgumentException( "The parameter 'decoration' can not be null" ); } Skin skin = decoration.getSkin(); if ( skin == null ) { skin = Skin.getDefaultSkin(); } String version = skin.getVersion(); Artifact artifact; try { if ( version == null ) { version = Artifact.RELEASE_VERSION; } VersionRange versionSpec = VersionRange.createFromVersionSpec( version ); artifact = artifactFactory.createDependencyArtifact( skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null, null ); artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); } catch ( InvalidVersionSpecificationException e ) { throw new SiteToolException( "InvalidVersionSpecificationException: The skin version '" + version + "' is not valid: " + e.getMessage() ); } catch ( ArtifactResolutionException e ) { throw new SiteToolException( "ArtifactResolutionException: Unable to find skin", e ); } catch ( ArtifactNotFoundException e ) { throw new SiteToolException( "ArtifactNotFoundException: The skin does not exist: " + e.getMessage() ); } return artifact; } /** {@inheritDoc} */ public Artifact getDefaultSkinArtifact( ArtifactRepository localRepository, List remoteArtifactRepositories ) throws SiteToolException { return getSkinArtifactFromRepository( localRepository, remoteArtifactRepositories, new DecorationModel() ); } /** {@inheritDoc} */ public String getRelativePath( String to, String from ) { if ( to == null ) { throw new IllegalArgumentException( "The parameter 'to' can not be null" ); } if ( from == null ) { throw new IllegalArgumentException( "The parameter 'from' can not be null" ); } URL toUrl = null; URL fromUrl = null; String toPath = to; String fromPath = from; try { toUrl = new URL( to ); } catch ( MalformedURLException e ) { try { toUrl = new File( getNormalizedPath( to ) ).toURI().toURL(); } catch ( MalformedURLException e1 ) { getLogger().warn( "Unable to load a URL for '" + to + "': " + e.getMessage() ); } } try { fromUrl = new URL( from ); } catch ( MalformedURLException e ) { try { fromUrl = new File( getNormalizedPath( from ) ).toURI().toURL(); } catch ( MalformedURLException e1 ) { getLogger().warn( "Unable to load a URL for '" + from + "': " + e.getMessage() ); } } if ( toUrl != null && fromUrl != null ) { // URLs, determine if they share protocol and domain info if ( ( toUrl.getProtocol().equalsIgnoreCase( fromUrl.getProtocol() ) ) && ( toUrl.getHost().equalsIgnoreCase( fromUrl.getHost() ) ) && ( toUrl.getPort() == fromUrl.getPort() ) ) { // shared URL domain details, use URI to determine relative path toPath = toUrl.getFile(); fromPath = fromUrl.getFile(); } else { // don't share basic URL information, no relative available return to; } } else if ( ( toUrl != null && fromUrl == null ) || ( toUrl == null && fromUrl != null ) ) { // one is a URL and the other isnt, no relative available. return to; } // either the two locations are not URLs or if they are they // share the common protocol and domain info and we are left // with their URI information // normalize the path delimiters toPath = new File( toPath ).getPath(); fromPath = new File( fromPath ).getPath(); // strip any leading slashes if its a windows path if ( toPath.matches( "^\\[a-zA-Z]:" ) ) { toPath = toPath.substring( 1 ); } if ( fromPath.matches( "^\\[a-zA-Z]:" ) ) { fromPath = fromPath.substring( 1 ); } // lowercase windows drive letters. if ( toPath.startsWith( ":", 1 ) ) { toPath = toPath.substring( 0, 1 ).toLowerCase() + toPath.substring( 1 ); } if ( fromPath.startsWith( ":", 1 ) ) { fromPath = fromPath.substring( 0, 1 ).toLowerCase() + fromPath.substring( 1 ); } // check for the presence of windows drives. No relative way of // traversing from one to the other. if ( ( toPath.startsWith( ":", 1 ) && fromPath.startsWith( ":", 1 ) ) && ( !toPath.substring( 0, 1 ).equals( fromPath.substring( 0, 1 ) ) ) ) { // they both have drive path element but they don't match, no // relative path return to; } if ( ( toPath.startsWith( ":", 1 ) && !fromPath.startsWith( ":", 1 ) ) || ( !toPath.startsWith( ":", 1 ) && fromPath.startsWith( ":", 1 ) ) ) { // one has a drive path element and the other doesn't, no relative // path. return to; } // use tokenizer to traverse paths and for lazy checking StringTokenizer toTokeniser = new StringTokenizer( toPath, File.separator ); StringTokenizer fromTokeniser = new StringTokenizer( fromPath, File.separator ); int count = 0; // walk along the to path looking for divergence from the from path while ( toTokeniser.hasMoreTokens() && fromTokeniser.hasMoreTokens() ) { if ( File.separatorChar == '\\' ) { if ( !fromTokeniser.nextToken().equalsIgnoreCase( toTokeniser.nextToken() ) ) { break; } } else { if ( !fromTokeniser.nextToken().equals( toTokeniser.nextToken() ) ) { break; } } count++; } // reinitialize the tokenizers to count positions to retrieve the // gobbled token toTokeniser = new StringTokenizer( toPath, File.separator ); fromTokeniser = new StringTokenizer( fromPath, File.separator ); while ( count-- > 0 ) { fromTokeniser.nextToken(); toTokeniser.nextToken(); } String relativePath = ""; // add back refs for the rest of from location. while ( fromTokeniser.hasMoreTokens() ) { fromTokeniser.nextToken(); relativePath += ".."; if ( fromTokeniser.hasMoreTokens() ) { relativePath += File.separatorChar; } } if ( relativePath.length() != 0 && toTokeniser.hasMoreTokens() ) { relativePath += File.separatorChar; } // add fwd fills for whatever's left of to. while ( toTokeniser.hasMoreTokens() ) { relativePath += toTokeniser.nextToken(); if ( toTokeniser.hasMoreTokens() ) { relativePath += File.separatorChar; } } if ( !relativePath.equals( to ) ) { getLogger().debug( "Mapped url: " + to + " to relative path: " + relativePath ); } return relativePath; } /** {@inheritDoc} */ public File getSiteDescriptorFromBasedir( String siteDirectory, File basedir, Locale locale ) { if ( basedir == null ) { throw new IllegalArgumentException( "The parameter 'basedir' can not be null" ); } if ( siteDirectory == null ) { // TODO need to be more dynamic siteDirectory = "src/site"; } if ( locale == null ) { locale = new Locale( "" ); } File siteDir = new File( basedir, siteDirectory ); File siteDescriptor = new File( siteDir, "site_" + locale.getLanguage() + ".xml" ); if ( !siteDescriptor.isFile() ) { siteDescriptor = new File( siteDir, "site.xml" ); } return siteDescriptor; } /** {@inheritDoc} */ public File getSiteDescriptorFromRepository( MavenProject project, ArtifactRepository localRepository, List repositories, Locale locale ) throws SiteToolException { if ( project == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( localRepository == null ) { throw new IllegalArgumentException( "The parameter 'localRepository' can not be null" ); } if ( repositories == null ) { throw new IllegalArgumentException( "The parameter 'remoteArtifactRepositories' can not be null" ); } if ( locale == null ) { locale = new Locale( "" ); } try { return resolveSiteDescriptor( project, localRepository, repositories, locale ); } catch ( ArtifactNotFoundException e ) { getLogger().debug( "ArtifactNotFoundException: Unable to locate site descriptor: " + e ); return null; } catch ( ArtifactResolutionException e ) { throw new SiteToolException( "ArtifactResolutionException: Unable to locate site descriptor: " + e.getMessage() ); } catch ( IOException e ) { throw new SiteToolException( "IOException: Unable to locate site descriptor: " + e.getMessage() ); } } /** {@inheritDoc} */ public DecorationModel getDecorationModel( MavenProject project, List reactorProjects, ArtifactRepository localRepository, List repositories, String siteDirectory, Locale locale, String inputEncoding, String outputEncoding ) throws SiteToolException { if ( project == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( reactorProjects == null ) { throw new IllegalArgumentException( "The parameter 'reactorProjects' can not be null" ); } if ( localRepository == null ) { throw new IllegalArgumentException( "The parameter 'localRepository' can not be null" ); } if ( repositories == null ) { throw new IllegalArgumentException( "The parameter 'repositories' can not be null" ); } if ( inputEncoding == null ) { throw new IllegalArgumentException( "The parameter 'inputEncoding' can not be null" ); } if ( outputEncoding == null ) { throw new IllegalArgumentException( "The parameter 'outputEncoding' can not be null" ); } if ( locale == null ) { locale = Locale.getDefault(); } Map props = new HashMap(); // This is to support the deprecated ${reports} and ${modules} tags. props.put( "reports", "\n" ); props.put( "modules", "\n" ); DecorationModel decorationModel = getDecorationModel( project, reactorProjects, localRepository, repositories, siteDirectory, locale, props, inputEncoding, outputEncoding ); if ( decorationModel == null ) { String siteDescriptorContent; try { // Note the default is not a super class - it is used when nothing else is found siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ), "UTF-8" ); } catch ( IOException e ) { throw new SiteToolException( "Error reading default site descriptor: " + e.getMessage(), e ); } siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent, inputEncoding, outputEncoding ); decorationModel = readDecorationModel( siteDescriptorContent ); } MavenProject parentProject = getParentProject( project, reactorProjects, localRepository ); if ( parentProject != null ) { populateParentMenu( decorationModel, locale, project, parentProject, true ); } populateModulesMenu( project, reactorProjects, localRepository, decorationModel, locale, true ); if ( decorationModel.getBannerLeft() == null ) { // extra default to set Banner banner = new Banner(); banner.setName( project.getName() ); decorationModel.setBannerLeft( banner ); } if ( project.getUrl() != null ) { assembler.resolvePaths( decorationModel, project.getUrl() ); } else { getLogger().warn( "No URL defined for the project - decoration links will not be resolved" ); } return decorationModel; } /** {@inheritDoc} */ public void populateReportsMenu( DecorationModel decorationModel, Locale locale, Map categories ) { if ( decorationModel == null ) { throw new IllegalArgumentException( "The parameter 'decorationModel' can not be null" ); } if ( categories == null ) { throw new IllegalArgumentException( "The parameter 'categories' can not be null" ); } if ( locale == null ) { locale = Locale.getDefault(); } Menu menu = decorationModel.getMenuRef( "reports" ); if ( menu != null ) { if ( menu.getName() == null ) { menu.setName( i18n.getString( "site-tool", locale, "decorationModel.menu.projectdocumentation" ) ); } boolean found = false; if ( menu.getItems().isEmpty() ) { List categoryReports = (List) categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION ); if ( !isEmptyList( categoryReports ) ) { MenuItem item = createCategoryMenu( i18n.getString( "site-tool", locale, "decorationModel.menu.projectinformation" ), "/project-info.html", categoryReports, locale ); menu.getItems().add( item ); found = true; } categoryReports = (List) categories.get( MavenReport.CATEGORY_PROJECT_REPORTS ); if ( !isEmptyList( categoryReports ) ) { MenuItem item = createCategoryMenu( i18n.getString( "site-tool", locale, "decorationModel.menu.projectreports" ), "/project-reports.html", categoryReports, locale ); menu.getItems().add( item ); found = true; } } if ( !found ) { decorationModel.removeMenuRef( "reports" ); } } } /** {@inheritDoc} */ public String getInterpolatedSiteDescriptorContent( Map props, MavenProject aProject, String siteDescriptorContent, String inputEncoding, String outputEncoding ) throws SiteToolException { if ( props == null ) { throw new IllegalArgumentException( "The parameter 'props' can not be null" ); } if ( aProject == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( siteDescriptorContent == null ) { throw new IllegalArgumentException( "The parameter 'siteDescriptorContent' can not be null" ); } if ( inputEncoding == null ) { throw new IllegalArgumentException( "The parameter 'inputEncoding' can not be null" ); } if ( outputEncoding == null ) { throw new IllegalArgumentException( "The parameter 'outputEncoding' can not be null" ); } // MSITE-201: The ObjectBasedValueSource( aProject ) below will match // ${modules} to aProject.getModules(), so we need to interpolate that // first. Map modulesProps = new HashMap(); // Legacy for the old ${modules} syntax modulesProps.put( "modules", "" ); siteDescriptorContent = StringUtils.interpolate( siteDescriptorContent, modulesProps ); RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); try { interpolator.addValueSource( new EnvarBasedValueSource() ); } catch ( IOException e ) { // Prefer logging? throw new SiteToolException( "IOException: cannot interpolate environment properties: " + e.getMessage(), e ); } interpolator.addValueSource( new ObjectBasedValueSource( aProject ) ); interpolator.addValueSource( new MapBasedValueSource( aProject.getProperties() ) ); siteDescriptorContent = interpolator.interpolate( siteDescriptorContent, "project" ); props.put( "inputEncoding", inputEncoding ); props.put( "outputEncoding", outputEncoding ); // Legacy for the old ${parentProject} syntax props.put( "parentProject", "" ); // Legacy for the old ${reports} syntax props.put( "reports", "" ); return StringUtils.interpolate( siteDescriptorContent, props ); } /** {@inheritDoc} */ public MavenProject getParentProject( MavenProject aProject, List reactorProjects, ArtifactRepository localRepository ) { if ( aProject == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( reactorProjects == null ) { throw new IllegalArgumentException( "The parameter 'reactorProjects' can not be null" ); } if ( localRepository == null ) { throw new IllegalArgumentException( "The parameter 'localRepository' can not be null" ); } MavenProject parentProject = null; MavenProject origParent = aProject.getParent(); if ( origParent != null ) { Iterator reactorItr = reactorProjects.iterator(); while ( reactorItr.hasNext() ) { MavenProject reactorProject = (MavenProject) reactorItr.next(); if ( reactorProject.getGroupId().equals( origParent.getGroupId() ) && reactorProject.getArtifactId().equals( origParent.getArtifactId() ) && reactorProject.getVersion().equals( origParent.getVersion() ) ) { parentProject = reactorProject; break; } } if ( parentProject == null && aProject.getBasedir() != null ) { try { File pomFile = new File( aProject.getBasedir(), aProject.getModel().getParent().getRelativePath() ); if ( pomFile.isDirectory() ) { pomFile = new File( pomFile, "pom.xml" ); } pomFile = new File( getNormalizedPath( pomFile.getPath() ) ); if ( pomFile.isFile() ) { MavenProject mavenProject = mavenProjectBuilder.build( pomFile, localRepository, null ); if ( mavenProject.getGroupId().equals( origParent.getGroupId() ) && mavenProject.getArtifactId().equals( origParent.getArtifactId() ) && mavenProject.getVersion().equals( origParent.getVersion() ) ) { parentProject = mavenProject; } } } catch ( ProjectBuildingException e ) { getLogger().info( "Unable to load parent project from a relative path: " + e.getMessage() ); } } if ( parentProject == null ) { try { parentProject = mavenProjectBuilder.buildFromRepository( aProject.getParentArtifact(), aProject .getRemoteArtifactRepositories(), localRepository ); getLogger().info( "Parent project loaded from repository." ); } catch ( ProjectBuildingException e ) { getLogger().warn( "Unable to load parent project from repository: " + e.getMessage() ); } } if ( parentProject == null ) { // fallback to uninterpolated value parentProject = origParent; } } return parentProject; } /** {@inheritDoc} */ public void populateParentMenu( DecorationModel decorationModel, Locale locale, MavenProject project, MavenProject parentProject, boolean keepInheritedRefs ) { if ( decorationModel == null ) { throw new IllegalArgumentException( "The parameter 'decorationModel' can not be null" ); } if ( project == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( parentProject == null ) { throw new IllegalArgumentException( "The parameter 'parentProject' can not be null" ); } if ( locale == null ) { locale = Locale.getDefault(); } Menu menu = decorationModel.getMenuRef( "parent" ); if ( menu == null ) { return; } if ( !keepInheritedRefs || !menu.isInheritAsRef() ) { String parentUrl = parentProject.getUrl(); if ( parentUrl != null ) { if ( parentUrl.endsWith( "/" ) ) { parentUrl += "index.html"; } else { parentUrl += "/index.html"; } parentUrl = getRelativePath( parentUrl, project.getUrl() ); } else { // parent has no url, assume relative path is given by site structure File parentBasedir = parentProject.getBasedir(); // First make sure that the parent is available on the file system if ( parentBasedir != null ) { // Try to find the relative path to the parent via the file system String parentPath = parentBasedir.getAbsolutePath(); String projectPath = project.getBasedir().getAbsolutePath(); parentUrl = getRelativePath( parentPath, projectPath ) + "/index.html"; } } // Only add the parent menu if we were able to find a URL for it if ( parentUrl == null ) { getLogger().warn( "Unable to find a URL to the parent project. The parent menu will NOT be added." ); } else { if ( menu.getName() == null ) { menu.setName( i18n.getString( "site-tool", locale, "decorationModel.menu.parentproject" ) ); } MenuItem item = new MenuItem(); item.setName( parentProject.getName() ); item.setHref( parentUrl ); menu.addItem( item ); } } } /** * {@inheritDoc} * @deprecated Please use * {@link #populateParentMenu(DecorationModel, Locale, MavenProject, MavenProject, boolean)} instead */ public void populateProjectParentMenu( DecorationModel decorationModel, Locale locale, MavenProject project, MavenProject parentProject, boolean keepInheritedRefs ) { populateParentMenu( decorationModel, locale, project, parentProject, keepInheritedRefs ); } /** * {@inheritDoc} * @deprecated Please use * {@link #populateModulesMenu(MavenProject, List, ArtifactRepository, DecorationModel, Locale, boolean)} * instead */ public void populateModules( MavenProject project, List reactorProjects, ArtifactRepository localRepository, DecorationModel decorationModel, Locale locale, boolean keepInheritedRefs ) throws SiteToolException { populateModulesMenu( project, reactorProjects, localRepository, decorationModel, locale, keepInheritedRefs ); } /** {@inheritDoc} */ public void populateModulesMenu( MavenProject project, List reactorProjects, ArtifactRepository localRepository, DecorationModel decorationModel, Locale locale, boolean keepInheritedRefs ) throws SiteToolException { if ( project == null ) { throw new IllegalArgumentException( "The parameter 'project' can not be null" ); } if ( reactorProjects == null ) { throw new IllegalArgumentException( "The parameter 'reactorProjects' can not be null" ); } if ( localRepository == null ) { throw new IllegalArgumentException( "The parameter 'localRepository' can not be null" ); } if ( decorationModel == null ) { throw new IllegalArgumentException( "The parameter 'decorationModel' can not be null" ); } if ( locale == null ) { locale = Locale.getDefault(); } Menu menu = decorationModel.getMenuRef( "modules" ); if ( menu == null ) { return; } if ( !keepInheritedRefs || !menu.isInheritAsRef() ) { // we require child modules and reactors to process module menu if ( project.getModules().size() > 0 ) { List projects = reactorProjects; if ( menu.getName() == null ) { menu.setName( i18n.getString( "site-tool", locale, "decorationModel.menu.projectmodules" ) ); } if ( projects.size() == 1 ) { getLogger().debug( "Attempting to load module information from local filesystem" ); // Not running reactor - search for the projects manually List models = new ArrayList( project.getModules().size() ); for ( Iterator i = project.getModules().iterator(); i.hasNext(); ) { String module = (String) i.next(); Model model; File f = new File( project.getBasedir(), module + "/pom.xml" ); if ( f.exists() ) { try { model = mavenProjectBuilder.build( f, localRepository, null ).getModel(); } catch ( ProjectBuildingException e ) { throw new SiteToolException( "Unable to read local module-POM", e ); } } else { getLogger().warn( "No filesystem module-POM available" ); model = new Model(); model.setName( module ); model.setUrl( module ); } models.add( model ); } populateModulesMenuItemsFromModels( project, models, menu ); } else { populateModulesMenuItemsFromReactorProjects( project, reactorProjects, menu ); } } else { decorationModel.removeMenuRef( "modules" ); } } } /** {@inheritDoc} */ public List getAvailableLocales( String locales ) { List localesList = new ArrayList(); if ( locales != null ) { String[] localesArray = StringUtils.split( locales, "," ); for ( int i = 0; i < localesArray.length; i++ ) { Locale locale = codeToLocale( localesArray[i] ); if ( locale != null ) { if ( !Arrays.asList( Locale.getAvailableLocales() ).contains( locale ) ) { if ( getLogger().isWarnEnabled() ) { getLogger().warn( "The locale parsed defined by '" + locale + "' is not available in this Java Virtual Machine (" + System.getProperty( "java.version" ) + " from " + System.getProperty( "java.vendor" ) + ") - IGNORING" ); } continue; } // Default bundles are in English if ( ( !locale.getLanguage().equals( DEFAULT_LOCALE.getLanguage() ) ) && ( !i18n.getBundle( "site-tool", locale ).getLocale().getLanguage() .equals( locale.getLanguage() ) ) ) { StringBuffer sb = new StringBuffer(); sb.append( "The locale '" ).append( locale ).append( "' (" ); sb.append( locale.getDisplayName( Locale.ENGLISH ) ); sb.append( ") is not currently support by Maven - IGNORING. " ); sb.append( "\n" ); sb.append( "Contribution are welcome and greatly appreciated! " ); sb.append( "\n" ); sb.append( "If you want to contribute a new translation, please visit " ); sb.append( "http://maven.apache.org/plugins/maven-site-plugin/i18n.html " ); sb.append( "for detailed instructions." ); if ( getLogger().isWarnEnabled() ) { getLogger().warn( sb.toString() ); } continue; } localesList.add( locale ); } } } if ( localesList.isEmpty() ) { localesList = Collections.singletonList( DEFAULT_LOCALE ); } return localesList; } /** {@inheritDoc} */ public Locale codeToLocale( String localeCode ) { if ( localeCode == null ) { return null; } if ( "default".equalsIgnoreCase( localeCode ) ) { return Locale.getDefault(); } String language = ""; String country = ""; String variant = ""; StringTokenizer tokenizer = new StringTokenizer( localeCode, "_" ); final int maxTokens = 3; if ( tokenizer.countTokens() > maxTokens ) { if ( getLogger().isWarnEnabled() ) { getLogger().warn( "Invalid java.util.Locale format for '" + localeCode + "' entry - IGNORING" ); } return null; } if ( tokenizer.hasMoreTokens() ) { language = tokenizer.nextToken(); if ( tokenizer.hasMoreTokens() ) { country = tokenizer.nextToken(); if ( tokenizer.hasMoreTokens() ) { variant = tokenizer.nextToken(); } } } return new Locale( language, country, variant ); } // ---------------------------------------------------------------------- // Protected methods // ---------------------------------------------------------------------- /** * @param path could be null. * @return the path normalized, i.e. by eliminating "/../" and "/./" in the path. * @see FilenameUtils#normalize(String) */ protected static String getNormalizedPath( String path ) { String normalized = FilenameUtils.normalize( path ); if ( normalized == null ) { normalized = path; } return ( normalized == null ) ? null : normalized.replace( '\\', '/' ); } // ---------------------------------------------------------------------- // Private methods // ---------------------------------------------------------------------- /** * @param project not null * @param localRepository not null * @param repositories not null * @param locale not null * @return the resolved site descriptor * @throws IOException if any * @throws ArtifactResolutionException if any * @throws ArtifactNotFoundException if any */ private File resolveSiteDescriptor( MavenProject project, ArtifactRepository localRepository, List repositories, Locale locale ) throws IOException, ArtifactResolutionException, ArtifactNotFoundException { File result; // TODO: this is a bit crude - proper type, or proper handling as metadata rather than an artifact in 2.1? Artifact artifact = artifactFactory.createArtifactWithClassifier( project.getGroupId(), project.getArtifactId(), project.getVersion(), "xml", "site_" + locale.getLanguage() ); boolean found = false; try { artifactResolver.resolve( artifact, repositories, localRepository ); result = artifact.getFile(); // we use zero length files to avoid re-resolution (see below) if ( result.length() > 0 ) { found = true; } else { getLogger().debug( "Skipped site descriptor for locale " + locale.getLanguage() ); } } catch ( ArtifactNotFoundException e ) { getLogger().debug( "Unable to locate site descriptor for locale " + locale.getLanguage() + ": " + e ); // we can afford to write an empty descriptor here as we don't expect it to turn up later in the remote // repository, because the parent was already released (and snapshots are updated automatically if changed) result = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) ); result.getParentFile().mkdirs(); result.createNewFile(); } if ( !found ) { artifact = artifactFactory.createArtifactWithClassifier( project.getGroupId(), project.getArtifactId(), project.getVersion(), "xml", "site" ); try { artifactResolver.resolve( artifact, repositories, localRepository ); } catch ( ArtifactNotFoundException e ) { // see above regarding this zero length file result = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) ); result.getParentFile().mkdirs(); result.createNewFile(); throw e; } result = artifact.getFile(); // we use zero length files to avoid re-resolution (see below) if ( result.length() == 0 ) { getLogger().debug( "Skipped remote site descriptor check" ); result = null; } } return result; } /** * @param project not null * @param reactorProjects not null * @param localRepository not null * @param repositories not null * @param siteDirectory not null * @param locale not null * @param origProps not null * @param inputEncoding not null * @param outputEncoding not null * @return the decoration model depending the locale * @throws SiteToolException if any */ private DecorationModel getDecorationModel( MavenProject project, List reactorProjects, ArtifactRepository localRepository, List repositories, String siteDirectory, Locale locale, Map origProps, String inputEncoding, String outputEncoding ) throws SiteToolException { Map props = new HashMap( origProps ); File siteDescriptor; if ( project.getBasedir() == null ) { // POM is in the repository, look there for site descriptor try { siteDescriptor = getSiteDescriptorFromRepository( project, localRepository, repositories, locale ); } catch ( SiteToolException e ) { throw new SiteToolException( "The site descriptor cannot be resolved from the repository: " + e.getMessage(), e ); } } else { siteDescriptor = getSiteDescriptorFromBasedir( siteDirectory, project.getBasedir(), locale ); } String siteDescriptorContent = null; long siteDescriptorLastModified = 0L; try { if ( siteDescriptor != null && siteDescriptor.exists() ) { getLogger().debug( "Reading site descriptor from " + siteDescriptor ); Reader siteDescriptorReader = ReaderFactory.newXmlReader( siteDescriptor ); siteDescriptorContent = IOUtil.toString( siteDescriptorReader ); siteDescriptorLastModified = siteDescriptor.lastModified(); } } catch ( IOException e ) { throw new SiteToolException( "The site descriptor cannot be read!", e ); } DecorationModel decoration = null; if ( siteDescriptorContent != null ) { siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent, inputEncoding, outputEncoding ); decoration = readDecorationModel( siteDescriptorContent ); decoration.setLastModified( siteDescriptorLastModified ); } MavenProject parentProject = getParentProject( project, reactorProjects, localRepository ); if ( parentProject != null ) { getLogger().debug( "Parent project loaded ..." ); DecorationModel parent = getDecorationModel( parentProject, reactorProjects, localRepository, repositories, siteDirectory, locale, props, inputEncoding, outputEncoding ); // MSHARED-116 requires an empty decoration model (instead of a null one) // MSHARED-145 requires us to do this only if there is a parent to merge it with if ( decoration == null && parent != null ) { // we have no site descriptor: merge the parent into an empty one decoration = new DecorationModel(); } // Merge the parent and child site descriptors assembler.assembleModelInheritance( project.getName(), decoration, parent, project.getUrl(), parentProject.getUrl() == null ? project.getUrl() : parentProject.getUrl() ); } if ( decoration != null && decoration.getSkin() != null ) { getLogger().debug( "Skin used: " + decoration.getSkin() ); } return decoration; } /** * @param siteDescriptorContent not null * @return the decoration model object * @throws SiteToolException if any */ private DecorationModel readDecorationModel( String siteDescriptorContent ) throws SiteToolException { DecorationModel decoration; try { decoration = new DecorationXpp3Reader().read( new StringReader( siteDescriptorContent ) ); } catch ( XmlPullParserException e ) { throw new SiteToolException( "Error parsing site descriptor", e ); } catch ( IOException e ) { throw new SiteToolException( "Error reading site descriptor", e ); } return decoration; } /** * @param project not null * @param reactorProjects not null * @param menu not null */ private void populateModulesMenuItemsFromReactorProjects( MavenProject project, List reactorProjects, Menu menu ) { Iterator iterator = getModuleProjects( project, reactorProjects, 1 ).iterator(); while ( iterator.hasNext() ) { MavenProject moduleProject = (MavenProject) iterator.next(); appendMenuItem( project, menu, moduleProject.getName(), moduleProject.getUrl(), moduleProject.getArtifactId() ); } } /** * Return all the projects that are modules, or modules of modules, of the specified project found within the * reactor. *

* The levels parameter controls how many descendant levels of modules are returned. With levels equal * to 1, only the immediate modules of the specified project are returned. *

* If levels equals 2 it returns those modules' modules as well. *

* If levels equals -1 it returns the entire module hierarchy beneath the specified project. Note that this is * simply the equivalent to the entire reactor if the specified project is the root execution project. * * @param project the project to search under * @param reactorProjects The projects in the reactor * @param levels the number of descendant levels to return * @return the list of module projects. */ private List getModuleProjects( final MavenProject project, final List reactorProjects, final int levels ) { List moduleProjects = new ArrayList(); boolean infinite = ( levels == -1 ); if ( ( reactorProjects != null ) && ( infinite || levels > 0 ) ) { Iterator iterator = reactorProjects.iterator(); while ( iterator.hasNext() ) { MavenProject reactorProject = (MavenProject) iterator.next(); if ( isModuleOfProject( project, reactorProject ) ) { moduleProjects.add( reactorProject ); // recurse to find the modules of this project moduleProjects.addAll( getModuleProjects( reactorProject, reactorProjects, infinite ? levels : levels - 1 ) ); } } } return moduleProjects; } /** * Return true if the supplied potentialModule project is a module of the specified parentProject. * * @param parentProject the parent project. * @param potentialModule the potential module project. * @return true if the potentialModule is indeed a module of the specified parent project. */ private boolean isModuleOfProject( MavenProject parentProject, MavenProject potentialModule ) { boolean result = false; List modules = parentProject.getModules(); if ( modules != null && parentProject != potentialModule ) { File parentBaseDir = parentProject.getBasedir(); Iterator iterator = modules.iterator(); while ( iterator.hasNext() ) { String module = (String) iterator.next(); File moduleBaseDir = new File( parentBaseDir, module ); try { String lhs = potentialModule.getBasedir().getCanonicalPath(); String rhs = moduleBaseDir.getCanonicalPath(); if ( lhs.equals( rhs ) ) { result = true; break; } } catch ( IOException e ) { getLogger().error( "Error encountered when trying to resolve canonical module paths: " + e.getMessage() ); } } } return result; } /** * @param project not null * @param models not null * @param menu not null */ private void populateModulesMenuItemsFromModels( MavenProject project, List models, Menu menu ) { if ( models != null && models.size() > 1 ) { Iterator reactorItr = models.iterator(); while ( reactorItr.hasNext() ) { Model model = (Model) reactorItr.next(); String reactorUrl = model.getUrl(); String name = model.getName(); appendMenuItem( project, menu, name, reactorUrl, model.getArtifactId() ); } } } /** * @param project not null * @param menu not null * @param name not null * @param href could be null * @param defaultHref not null */ private void appendMenuItem( MavenProject project, Menu menu, String name, String href, String defaultHref ) { String selectedHref = href; if ( selectedHref == null ) { selectedHref = defaultHref; } MenuItem item = new MenuItem(); item.setName( name ); String baseUrl = project.getUrl(); if ( baseUrl != null ) { selectedHref = getRelativePath( selectedHref, baseUrl ); } if ( selectedHref.endsWith( "/" ) ) { item.setHref( selectedHref + "index.html" ); } else { item.setHref( selectedHref + "/index.html" ); } menu.addItem( item ); } /** * @param name not null * @param href not null * @param categoryReports not null * @param locale not null * @return the menu item object */ private MenuItem createCategoryMenu( String name, String href, List categoryReports, Locale locale ) { MenuItem item = new MenuItem(); item.setName( name ); item.setCollapse( true ); item.setHref( href ); Collections.sort( categoryReports, new ReportComparator( locale ) ); for ( Iterator k = categoryReports.iterator(); k.hasNext(); ) { MavenReport report = (MavenReport) k.next(); MenuItem subitem = new MenuItem(); subitem.setName( report.getName( locale ) ); subitem.setHref( report.getOutputName() + ".html" ); item.getItems().add( subitem ); } return item; } // ---------------------------------------------------------------------- // static methods // ---------------------------------------------------------------------- /** * Convenience method. * * @param list could be null * @return true if the list is null or empty */ private static boolean isEmptyList( List list ) { return list == null || list.isEmpty(); } } maven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/SiteTool.java0000644000175000017500000003332711167435430027456 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.io.File; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.doxia.site.decoration.DecorationModel; import org.apache.maven.project.MavenProject; /** * Tool to play with Doxia objects * like DecorationModel. * * @author Vincent Siveton * @version $Id: SiteTool.java 763760 2009-04-09 18:14:48Z ltheussl $ */ public interface SiteTool { /** Plexus Role */ String ROLE = SiteTool.class.getName(); /** * The locale by default for all default bundles * @see Locale#ENGLISH */ Locale DEFAULT_LOCALE = Locale.ENGLISH; /** * Get a skin artifact from one of the repositories. * * @param localRepository the Maven local repository, not null. * @param remoteArtifactRepositories the Maven remote repositories, not null. * @param decoration the Doxia site descriptor model, not null. * @return the Skin artifact defined in a DecorationModel from a given project and a * local repository * @throws SiteToolException if any */ Artifact getSkinArtifactFromRepository( ArtifactRepository localRepository, List remoteArtifactRepositories, DecorationModel decoration ) throws SiteToolException; /** * Get the default skin artifact for a project from one of the repositories. * * @param localRepository the Maven local repository, not null. * @param remoteArtifactRepositories the Maven remote repositories, not null. * @return the default Skin artifact from a given project and a local repository * @throws SiteToolException if any * @see org.apache.maven.doxia.site.decoration.Skin#getDefaultSkin() * @see #getSkinArtifactFromRepository(ArtifactRepository, List, DecorationModel) */ Artifact getDefaultSkinArtifact( ArtifactRepository localRepository, List remoteArtifactRepositories ) throws SiteToolException; /** * Calculate the relative path between two URLs or between two files. * * For example: *

*
to = "http://maven.apache.org" and from = "http://maven.apache.org"
*
return ""
*
to = "http://maven.apache.org" and from = "http://maven.apache.org/plugins/maven-site-plugin/"
*
return "../.."
*
to = "http://maven.apache.org/plugins/maven-site-plugin/" and from = "http://maven.apache.org"
*
return "plugins/maven-site-plugin"
*
to = "/myproject/myproject-module1" and from = "/myproject/myproject"
*
return "../myproject-module1"
*
* Note: The file separator depends on the system. * * @param to the to url of file as string * @param from the from url of file as string * @return a relative path from from to to. */ String getRelativePath( String to, String from ); /** * Get a site descriptor from the project's base direcory. * * @param siteDirectory The path to the directory containing the site.xml file, relative to the * project base directory. If null, using by default "src/site". * @param basedir not null. * @param locale the locale wanted for the site descriptor. If not null, searching for * site_localeLanguage.xml, otherwise searching for site.xml. * @return the site descriptor relative file, i.e. src/site/site.xml, depending on parameter values. */ File getSiteDescriptorFromBasedir( String siteDirectory, File basedir, Locale locale ); /** * Get a site descriptor from one of the repositories. * * @param project the Maven project, not null. * @param localRepository the Maven local repository, not null. * @param repositories the Maven remote repositories, not null. * @param locale the locale wanted for the site descriptor. If not null, searching for * site_localeLanguage.xml, otherwise searching for site.xml. * @return the site descriptor into the local repository after download of it from repositories or null if not * found in repositories. * @throws SiteToolException if any */ File getSiteDescriptorFromRepository( MavenProject project, ArtifactRepository localRepository, List repositories, Locale locale ) throws SiteToolException; /** * Get a decoration model for a project. * * @param project the Maven project, not null. * @param reactorProjects the Maven reactor projects, not null. * @param localRepository the Maven local repository, not null. * @param repositories the Maven remote repositories, not null. * @param siteDirectory The path to the directory containing the site.xml file, relative to the * project base directory. If null, using by default "src/site". * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param inputEncoding the input encoding of the site descriptor, not null. * @param outputEncoding the output encoding wanted, not null. * @return the DecorationModel object corresponding to the site.xml file with some * interpolations. * @throws SiteToolException if any */ DecorationModel getDecorationModel( MavenProject project, List reactorProjects, ArtifactRepository localRepository, List repositories, String siteDirectory, Locale locale, String inputEncoding, String outputEncoding ) throws SiteToolException; /** * Populate the reports menu part of the decoration model. * * @param decorationModel the Doxia DecorationModel, not null. * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param categories a map to put on the decoration model, not null. */ void populateReportsMenu( DecorationModel decorationModel, Locale locale, Map categories ); /** * Interpolating several expressions in the site descriptor content. Actually, the expressions can be in * the project, the environment variables and the specific properties like encoding. *

* For instance: *

*
${project.name}
*
The value from the POM of: *

* <project>
*   <name>myProjectName</name>
* </project> *

*
${my.value}
*
The value from the POM of: *

* <properties>
*   <my.value>hello</my.value>
* </properties> *

*
${JAVA_HOME}
*
The value of JAVA_HOME in the environment variables
*
* * @param props a map used for interpolation, not null. * @param aProject a Maven project, not null. * @param inputEncoding the input encoding of the site descriptor, not null. * @param outputEncoding the output encoding wanted, not null. * @param siteDescriptorContent the site descriptor file, not null. * @return the site descriptor content based on the site.xml file with interpolated strings. * @throws SiteToolException if errors happened during the interpolation. */ String getInterpolatedSiteDescriptorContent( Map props, MavenProject aProject, String siteDescriptorContent, String inputEncoding, String outputEncoding ) throws SiteToolException; /** * Returns the parent POM with interpolated URLs. Attempts to source this value from the * reactorProjects parameters if available (reactor env model attributes * are interpolated), or if the reactor is unavailable (-N) resorts to the * project.getParent().getUrl() value which will NOT have been interpolated. *

* TODO: once bug is fixed in Maven proper, remove this. * * @param aProject a Maven project, not null. * @param reactorProjects the Maven reactor projects, not null. * @param localRepository the Maven local repository, not null. * @return the parent project with interpolated URLs. */ MavenProject getParentProject( MavenProject aProject, List reactorProjects, ArtifactRepository localRepository ); /** * Populate the parent menu part of the decoration model. * * @param decorationModel the Doxia DecorationModel, not null. * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param project a Maven project, not null. * @param parentProject a Maven parent project, not null. * @param keepInheritedRefs used for inherited references. */ void populateParentMenu( DecorationModel decorationModel, Locale locale, MavenProject project, MavenProject parentProject, boolean keepInheritedRefs ); /** * Populate the parent menu part of the decoration model. * * @param decorationModel the Doxia DecorationModel, not null. * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param project a Maven project, not null. * @param parentProject a Maven parent project, not null. * @param keepInheritedRefs used for inherited references. * @deprecated Please use * {@link #populateParentMenu(DecorationModel, Locale, MavenProject, MavenProject, boolean)} instead */ void populateProjectParentMenu( DecorationModel decorationModel, Locale locale, MavenProject project, MavenProject parentProject, boolean keepInheritedRefs ); /** * Populate the modules menu part of the decoration model. * * @param project a Maven project, not null. * @param reactorProjects the Maven reactor projects, not null. * @param localRepository the Maven local repository, not null. * @param decorationModel the Doxia site descriptor model, not null. * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param keepInheritedRefs used for inherited references. * @throws SiteToolException if any * @deprecated Please use * {@link #populateModulesMenu(MavenProject, List, ArtifactRepository, DecorationModel, Locale, boolean)} * instead */ void populateModules( MavenProject project, List reactorProjects, ArtifactRepository localRepository, DecorationModel decorationModel, Locale locale, boolean keepInheritedRefs ) throws SiteToolException; /** * Populate the modules menu part of the decoration model. * * @param project a Maven project, not null. * @param reactorProjects the Maven reactor projects, not null. * @param localRepository the Maven local repository, not null. * @param decorationModel the Doxia site descriptor model, not null. * @param locale the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm. * @param keepInheritedRefs used for inherited references. * @throws SiteToolException if any */ void populateModulesMenu( MavenProject project, List reactorProjects, ArtifactRepository localRepository, DecorationModel decorationModel, Locale locale, boolean keepInheritedRefs ) throws SiteToolException; /** * Init the localesList variable. *

If the locales variable is available, the first valid token will be the * defaultLocale for this instance of the Java Virtual Machine.

* * @param locales A comma separated list of locales supported by Maven. The first valid token will be the * default Locale for this instance of the Java Virtual Machine. * @return a list of Locale */ List getAvailableLocales( String locales ); /** * Converts a locale code like "en", "en_US" or "en_US_win" to a java.util.Locale * object. *

If localeCode = default, return the current value of the default locale for this instance * of the Java Virtual Machine.

* * @param localeCode the locale code string. * @return a java.util.Locale object instancied or null if errors occurred * @see java.util.Locale#getDefault() */ Locale codeToLocale( String localeCode ); } maven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java0000644000175000017500000000420411020006575031315 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * An exception occurring during the execution of this tool. * * @author Vincent Siveton * @version $Id: SiteToolException.java 661727 2008-05-30 14:21:49Z bentmann $ */ public class SiteToolException extends Exception { /** serialVersionUID */ static final long serialVersionUID = 2331441332996055959L; /** * Construct a new SiteToolException exception wrapping an underlying Exception * and providing a message. * * @param message could be null * @param cause could be null */ public SiteToolException( String message, Exception cause ) { super( message, cause ); } /** * Construct a new SiteToolException exception wrapping an underlying Throwable * and providing a message. * * @param message could be null * @param cause could be null */ public SiteToolException( String message, Throwable cause ) { super( message, cause ); } /** * Construct a new SiteToolException exception providing a message. * * @param message could be null */ public SiteToolException( String message ) { super( message ); } } maven-doxia-tools-1.2.1/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java0000644000175000017500000000365411004716073031212 0ustar twernertwernerpackage org.apache.maven.doxia.tools; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.apache.maven.reporting.MavenReport; import java.text.Collator; import java.util.Comparator; import java.util.Locale; /** * Sorts reports. * * @author Brett Porter * @version $Id: ReportComparator.java 651860 2008-04-26 21:18:51Z dennisl $ * @todo move to reporting API? * @todo allow reports to define their order in some other way? */ public class ReportComparator implements Comparator { /** the local */ private final Locale locale; /** * Default constructor. * * @param locale not null */ public ReportComparator( Locale locale ) { if ( locale == null ) { throw new IllegalArgumentException( "locale should be defined" ); } this.locale = locale; } /** {@inheritDoc} */ public int compare( Object o1, Object o2 ) { MavenReport r1 = (MavenReport) o1; MavenReport r2 = (MavenReport) o2; Collator collator = Collator.getInstance( locale ); return collator.compare( r1.getName( locale ), r2.getName( locale ) ); } }