Chapter 4. Coding

4.1. Source code formatting

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.

4.2. Adding a new report

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 extends from:

org.jboss.tattletale.reporting.Report
    

and implements its abstract methods. The JavaDoc for JBoss Tattletale will show you the class hierarchy as you may want to extend from another class.

After you have implemented the new report you add it to the correct category inside

org.jboss.tattletale.Main
    

That is it. See the existing reports in JBoss Tattletale for examples on how to do this.

4.3. Adding a new classloader structure

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:

  • org.jboss.tattletale.reporting.classloader.NoopClassLoaderStructure

    A no operation plugin that always will include the queried archive in the report.

  • org.jboss.tattletale.reporting.classloader.JBossAS4ClassLoaderStructure

    Plugin for the JBoss Application Server 4.x series.

  • org.jboss.tattletale.reporting.classloader.JBossAS5ClassLoaderStructure

    Plugin for the JBoss Application Server 5.x series.

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