Author: ltheussl
Date: Mon Oct 11 10:18:19 2010
New Revision: 1021298

URL: http://svn.apache.org/viewvc?rev=1021298&view=rev
Log:
[MLINKCHECK-9] The necessary images are not included in the generated site, if 
you use a custom skin

Added:
    maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/
    maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_error_sml.gif
   (with props)
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_info_sml.gif
   (with props)
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_success_sml.gif
   (with props)
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_warning_sml.gif
   (with props)
Modified:
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java
    
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java

Modified: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java?rev=1021298&r1=1021297&r2=1021298&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java
 (original)
+++ 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java
 Mon Oct 11 10:18:19 2010
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.linkche
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -279,6 +280,13 @@ public class LinkcheckReport
     /** Result of the linkcheck in {...@link #execute()} */
     private LinkcheckModel result;
 
+    protected static final String ICON_SUCCESS = "images/icon_success_sml.gif";
+    protected static final String ICON_WARNING = "images/icon_warning_sml.gif";
+    protected static final String ICON_INFO = "images/icon_info_sml.gif";
+    protected static final String ICON_ERROR = "images/icon_error_sml.gif";
+    private static final String pluginResourcesBase = 
"org/apache/maven/plugin/linkcheck";
+    private static final String resourceNames[] = { ICON_SUCCESS, 
ICON_WARNING, ICON_INFO, ICON_ERROR };
+
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
@@ -523,6 +531,27 @@ public class LinkcheckReport
 
         reportGenerator.generateReport( locale, linkcheckModel, getSink() );
         closeReport();
+
+        // Copy the images
+        copyStaticResources();
+    }
+
+    private void copyStaticResources()
+    {
+        try
+        {
+            getLog().debug( "Copying static linkcheck resources." );
+            for ( int i = 0; i < resourceNames.length; i++ )
+            {
+                URL url = this.getClass().getClassLoader().getResource( 
pluginResourcesBase + "/" + resourceNames[i] );
+                FileUtils.copyURLToFile( url, new File( 
getReportOutputDirectory(), resourceNames[i] ) );
+            }
+        }
+        catch ( IOException e )
+        {
+            getLog().error( "Unable to copy icons for linkcheck report." );
+            getLog().debug( e );
+        }
     }
 
     private static int[] asIntArray( Integer[] array )

Modified: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java?rev=1021298&r1=1021297&r2=1021298&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java
 (original)
+++ 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java
 Mon Oct 11 10:18:19 2010
@@ -569,8 +569,7 @@ public class LinkcheckReportGenerator
         sink.figureCaption();
         sink.text( i18n.getString( "linkcheck-report", locale, 
"report.linkcheck.icon.error" ) );
         sink.figureCaption_();
-        // should be defined in skins
-        sink.figureGraphics( "images/icon_error_sml.gif" );
+        sink.figureGraphics( LinkcheckReport.ICON_ERROR );
         sink.figure_();
     }
 
@@ -580,8 +579,7 @@ public class LinkcheckReportGenerator
         sink.figureCaption();
         sink.text( i18n.getString( "linkcheck-report", locale, 
"report.linkcheck.icon.valid" ) );
         sink.figureCaption_();
-        // should be defined in skins
-        sink.figureGraphics( "images/icon_success_sml.gif" );
+        sink.figureGraphics( LinkcheckReport.ICON_SUCCESS );
         sink.figure_();
     }
 
@@ -591,8 +589,7 @@ public class LinkcheckReportGenerator
         sink.figureCaption();
         sink.text( i18n.getString( "linkcheck-report", locale, 
"report.linkcheck.icon.warning" ) );
         sink.figureCaption_();
-        // should be defined in skins
-        sink.figureGraphics( "images/icon_warning_sml.gif" );
+        sink.figureGraphics( LinkcheckReport.ICON_WARNING );
         sink.figure_();
     }
 

Added: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_error_sml.gif
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_error_sml.gif?rev=1021298&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_error_sml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_info_sml.gif
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_info_sml.gif?rev=1021298&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_info_sml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_success_sml.gif
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_success_sml.gif?rev=1021298&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_success_sml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_warning_sml.gif
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_warning_sml.gif?rev=1021298&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
maven/plugins/trunk/maven-linkcheck-plugin/src/main/resources/org/apache/maven/plugin/linkcheck/images/icon_warning_sml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to