Jump to: navigation, search

Custom Audit Rules

Revision as of 06:13, 2 June 2008 by Rcraddoc.cisco.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< To: Tigerstripe Extension Points

  • Full name : org.eclipse.tigerstripe.workbench.base.customArtifactAuditor

Purpose : In *addition* to the basic rules that implemented by Tigerstripe Workbench, this extension point can be used to add more project specific checks into the auditor. This can be used for example to ensure adherence to naming conventions and/or inheritance hierarchy. NOTE : Complex rules that cross many artifacts should NOT be implemented as audit rules as the performance can be seriously affected.

  • Usage :

The extension point supports any number of new rules, each of which has 2 attributes: "name" - This is only used for logging and has no functional purpose. "auditorClass" - This is the name of a class that must implement the IArtifactAuditor interface.

The IArtifactAuditor interface has two methods : public void setDetails(IProject project, IAbstractArtifact artifact); public void run(IProgressMonitor monitor);

The setDetails method will be called by the platform before the rule is run.


The rule should call the various TigerstripeProjectAuditor.reportXXXX methods on failures where XXX depends upon the severity.

  • Example :

This rule checks for artifact names that start with a lower case letter.

   public void run(IProgressMonitor monitor) {
       if (artifact.getName().matches("^[a-z]+.*")){
           TigerstripeProjectAuditor.reportError(
               "Artifact name should not start with lower case letter.", getIResource(), 222);
       }
   }
   public void setDetails(IProject project, IAbstractArtifact artifact){
       this.artifact = artifact;
       this.project = project;
   }
   protected IResource getIResource() {
      return TigerstripeProjectAuditor.getIResourceForArtifact(this.project,
         this.artifact);
   }