edu.colby.cs.JeSS.scanner
Class VisitorManager

java.lang.Object
  extended byedu.colby.cs.JeSS.scanner.VisitorManager

public class VisitorManager
extends java.lang.Object

This class is the root of the security analysis. It accepts the IPreference store in its initialization to determine the types of scans being performed. The scan() method then accepts the root of an AST and the corresponding source file for error reporting. This is the only class in the JeSS plugin that deals with markers. All markers are created and deleted from methods in this class. Errors are reported from the visitors through the reportProblem() method of JeSSVisitor, which in turn calls the reportProblem() method of this class.

Author:
rspitler

Field Summary
static java.lang.String MARKER_ID
           
private  int problems
           
private  org.eclipse.core.resources.IFile source
           
private  JeSSVisitorCollection visitors
           
 
Constructor Summary
VisitorManager(org.eclipse.jface.preference.IPreferenceStore store)
          Initialize the class using the IPreferenceStore to determine what scanners are used during the security analysis
 
Method Summary
static void deleteMarker(org.eclipse.core.resources.IMarker marker)
          Delete the passed marker.
static boolean deleteSecurityMarkers(org.eclipse.core.resources.IResource source)
          This method deletes all of the security markers in the passed resource
 org.eclipse.core.resources.IFile getResource()
           
 void reportProblem(java.lang.String errorMessage, Location loc, boolean isError, java.lang.String errorType)
          Take the passed values and create a Marker on the resource stored by the VisitorManager.
 int scan(org.eclipse.jdt.core.dom.CompilationUnit result, org.eclipse.core.resources.IFile file)
          Accept an AST root node in the form org.eclipse.jdt.core.dom.CompilationUnit and scan the AST for security bugs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

problems

private int problems

MARKER_ID

public static java.lang.String MARKER_ID

visitors

private JeSSVisitorCollection visitors

source

private org.eclipse.core.resources.IFile source
Constructor Detail

VisitorManager

public VisitorManager(org.eclipse.jface.preference.IPreferenceStore store)
Initialize the class using the IPreferenceStore to determine what scanners are used during the security analysis

Parameters:
store - - the plugin preferences
Method Detail

scan

public int scan(org.eclipse.jdt.core.dom.CompilationUnit result,
                org.eclipse.core.resources.IFile file)
Accept an AST root node in the form org.eclipse.jdt.core.dom.CompilationUnit and scan the AST for security bugs.

Parameters:
result - - the AST to be scanned
file - - the local resource for the AST
Returns:
warningsCount - the number of warnings generated

getResource

public org.eclipse.core.resources.IFile getResource()
Returns:
source - the underlying file of the current AST

reportProblem

public void reportProblem(java.lang.String errorMessage,
                          Location loc,
                          boolean isError,
                          java.lang.String errorType)
Take the passed values and create a Marker on the resource stored by the VisitorManager. Use MarkerUtilities to ensure that the marker appears in the source.

Parameters:
errorMessage - - the message related to the security bug
loc - - the Location object storing the placement of the bug
isError - - a boolean to determine if the bug is an error or warning
errorType - - TODO for future implementation of error resolution

deleteMarker

public static void deleteMarker(org.eclipse.core.resources.IMarker marker)
Delete the passed marker. This method is included here as it is the only way a marker is deleted in JeSS. If future implementations require additional handling when markers are removed then this is where the changes would be made

Parameters:
marker - - the marker to be removed

deleteSecurityMarkers

public static boolean deleteSecurityMarkers(org.eclipse.core.resources.IResource source)
This method deletes all of the security markers in the passed resource

Parameters:
source - - tje source in which to remove the markers
Returns:
boolean - result depending upon success