net.sourceforge.pmd
Class PMDDirectory

java.lang.Object
  |
  +--net.sourceforge.pmd.PMDDirectory

public class PMDDirectory
extends java.lang.Object

Defines and provides access to PMD's directory structure. The user defines the location of the root PMD directory, e.g., /users/userA/PMD. The PMD directory structure provides the following:

 The directory structure and contents are the following:
 
    PMD
       pmd.properties
       rulesets
          basic.xml
          design.xml
          import.xml
          com
             myCompany
                pmd
                   rules
                      myRule01.class
                      myRule02.class
                      myRule03.class
          net
             sourceforge
                pmd
                   rules
                      myNewExperimentalRule.class
 
 
The PMD directory is the root directory of all PMD files.

The pmd.properties file contains various information to be defined.

The rulesets directory contains the rule set files and rule class file directories.

A rule set file is a XML file that describes the rule set and its rules. This information is displayed and maintained in the PMD Viewer. The rule class files are called by PMD to perform the analysis.

All rule classes, other than the rule classes in pmd.jar, are stored in directory paths defined by each rule's class name. The Java classpath is appended with the rulesets directory so that the rule class and any supporting class files may be found.

NOTE: The user's home directory will contain a PMD directory with a user.preferences file. An entry in the user's preferences will be the path to the PMD root directory described above.

Since:
September 19, 2002
Version:
$Revision: 1.13 $, $Date: 2003/03/14 19:03:44 $
Author:
Donald A. Leckie

Method Summary
static PMDDirectory getDirectory()
           
 RuleSet getIncludedRules(int lowestPriorityForAnalysis)
          Gets a rule set containing only the rule sets and rules to be included for running the analysis.
 java.lang.String getPMDDirectoryPath()
           
 java.util.List getRegisteredRuleSets()
           
 RuleSet getRuleSet(java.io.File ruleSetFile)
          Gets the rule set for the given rule set file.
 RuleSet getRuleSet(java.io.File ruleSetFile, boolean onlyIfIncluded)
          Gets the rule set for the given rule set File.
 java.util.List getRuleSets()
           
 java.lang.String getRuleSetsDirectoryPath()
           
static void open(java.lang.String pathToPMD)
           
 void savePropertiesFile()
           
protected  void saveRuleSets(java.util.List ruleSetList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

open

public static final void open(java.lang.String pathToPMD)
                       throws PMDException
Parameters:
pathToPMD - The full path to the PMD directory, but excludes the PMD directory.
PMDException

getDirectory

public static final PMDDirectory getDirectory()
Returns:

getIncludedRules

public RuleSet getIncludedRules(int lowestPriorityForAnalysis)
                         throws PMDException
Gets a rule set containing only the rule sets and rules to be included for running the analysis.

Returns:
A rule containing only included rules.
PMDException

getRuleSet

public RuleSet getRuleSet(java.io.File ruleSetFile)
                   throws PMDException
Gets the rule set for the given rule set file. All rules in the rule set file are stored in the rule set regardless of their include state.

Parameters:
ruleSetFile - The file of the desired rule set.
Returns:
A rule set containing all of its rules.
Throws:
PMDException

getRuleSet

public RuleSet getRuleSet(java.io.File ruleSetFile,
                          boolean onlyIfIncluded)
                   throws PMDException
Gets the rule set for the given rule set File. All rules in the rule set file are stored in the rule set according of their include state and the onlyIfIncluded flag.

Parameters:
ruleSetFile - The file of the desired rule set.
Returns:
A rule set containing all of its rules.
Throws:
PMDException

getRegisteredRuleSets

public java.util.List getRegisteredRuleSets()
Returns:

getRuleSets

public java.util.List getRuleSets()
                           throws PMDException
Returns:
PMDException

getPMDDirectoryPath

public java.lang.String getPMDDirectoryPath()
Returns:

getRuleSetsDirectoryPath

public java.lang.String getRuleSetsDirectoryPath()
Returns:

saveRuleSets

protected void saveRuleSets(java.util.List ruleSetList)
Parameters:
ruleSetList -

savePropertiesFile

public void savePropertiesFile()
                        throws PMDException
PMDException


Copyright © 2002-2003 Project Ultra*Log @ DARPA. All Rights Reserved.