JBoss.orgCommunity Documentation

Chapter 4. Coding

4.1. Source code formatting
4.2. Adding a new report
4.3. Adding a new classloader structure

JBoss Tattletale uses 3 spaces for indentation with curly brakets on the next line as the class or the statement.

/**
 * My class
 */
public class MyClass
{
  /**
   * My method
   */
  public void myMethod()
  {
    if (value)
    {
      // Do something
    }
    else
    {
      // Do something else
    }
  }
}
    

Remember to add JavaDoc for all classes and methods.

You can verify the formatting rules by running checkstyle on the source code:

ant checkstyle
    

See the source code for more examples of the source code formatting rules.

Adding a new report to JBoss Tattletale is very easy, so if you have found a report that you would like to see that shouldn't stop you from adding it.

You need a class that implements:

org.jboss.tattletale.reporting.Report
    

The JavaDoc for JBoss Tattletale will show you the class hierarchy as you may want to extend from another class (org.jboss.tattletale.reporting.AbstractReport) for example.

After you have implemented the new report you add it to the properties file 'jboss-tattletale.properties'. For example:

	 	customreport.1=my.custom.package.customreport
	 

At runtime, as long as your custom jar file is in the classpath your custom report will be generated. If you were running from the command line for example:

		java -classpath tattletale.jar:customreporting.jar org.jboss.tattletale.Main [directory-of-source-jar] [output-directory]
	

JBoss Tattletale include functionality to identify certain classloader structures.

The plugins must implement the

 org.jboss.tattletale.reporting.classloader.ClassLoaderStructure
    

interface and contain a default no-argument constructor.

The interface only contain one method that needs to be implemented:

/**
 * Can one archive see the other
 * @param from The from archive
 * @param to The to archive
 * @return True if from can see to; otherwise false
 */
public boolean isVisible(Archive from, Archive to);
    

which returns true if the "from" archive can see the "to" archive. Otherwise false should be returned.

The current plugins can be used as a starting point for developing a new plugin:

The plugin is loaded through the 'classloader' key in jboss-tattletale.properties file. See the user guide for more information.