net.sf.jlayercheck.util
Class HTMLOutput

java.lang.Object
  extended by net.sf.jlayercheck.util.HTMLOutput

public class HTMLOutput
extends Object

Creates HTML output of the retrieved dependeny information.

Author:
webmaster@earth3d.org

Field Summary
protected static Logger logger
           
protected  String outputDir
          The directory to write the HTML output to.
 
Constructor Summary
HTMLOutput(String outputDir)
           
 
Method Summary
protected  void copyImage(String resourceName, String filename, String outputDir)
          Copies the names resource to the given destination directory.
static String formatPackageName(String classPackageName)
          Replaces "/" by "." to create a package name in the format the user expects to see.
 void write(DependencyVisitor dv, XMLConfiguration xcp)
          Writes the dependency information that was found into human readable HTML files containing the Java source code.
protected  void writeDependencyViolations(DependencyVisitor dv, XMLConfiguration xcp, PrintWriter pw, Map<String,Map<String,ClassDependency>> unallowedDependencies, Map<String,URL> sourceFiles)
          Writes a list of dependency violations to the given PrintWriter using html.
protected  void writeOrphanedClasses(DependencyVisitor dv, XMLConfiguration xcp, PrintWriter pw)
           
protected  void writeSourceFile(String filename, String content, Map<Integer,String> markedLines)
          Writes the given java source into the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static Logger logger

outputDir

protected String outputDir
The directory to write the HTML output to.

Constructor Detail

HTMLOutput

public HTMLOutput(String outputDir)
Method Detail

write

public void write(DependencyVisitor dv,
                  XMLConfiguration xcp)
           throws IOException
Writes the dependency information that was found into human readable HTML files containing the Java source code. The lines that are responsible for the illegal dependencies are marked.

Parameters:
dv - the DependencyVisitor containing the dependency information
xcp - the configuration that determines the architecture
Throws:
IOException

writeDependencyViolations

protected void writeDependencyViolations(DependencyVisitor dv,
                                         XMLConfiguration xcp,
                                         PrintWriter pw,
                                         Map<String,Map<String,ClassDependency>> unallowedDependencies,
                                         Map<String,URL> sourceFiles)
                                  throws IOException,
                                         OverlappingModulesDefinitionException
Writes a list of dependency violations to the given PrintWriter using html. It shows the classes that violate the architecture by accessing a module which they are not allowed to access.

Parameters:
dv -
xcp -
pw -
unallowedDependencies -
sourceFiles -
Throws:
IOException
OverlappingModulesDefinitionException

writeOrphanedClasses

protected void writeOrphanedClasses(DependencyVisitor dv,
                                    XMLConfiguration xcp,
                                    PrintWriter pw)

copyImage

protected void copyImage(String resourceName,
                         String filename,
                         String outputDir)
                  throws IOException
Copies the names resource to the given destination directory.

Parameters:
resourceName - the name of the resource to load
filename - the filename to save to
outputDir - the destination directory
Throws:
IOException

writeSourceFile

protected void writeSourceFile(String filename,
                               String content,
                               Map<Integer,String> markedLines)
                        throws IOException
Writes the given java source into the given file. The syntax is highlighted and the given marked lines are marked with small error symbols.

Parameters:
filename - output filename
content - java source
markedLines - a Map containing the line number and the message for this line
Throws:
IOException

formatPackageName

public static String formatPackageName(String classPackageName)
Replaces "/" by "." to create a package name in the format the user expects to see.

Parameters:
classPackageName -
Returns:


Copyright © 2007. All Rights Reserved.